PHP.nl

getimagesizefromstring

getimagesizefromstring

Get the size of an image from a string

 **getimagesizefromstring** string $string array $image_info

Identical to except that accepts a string instead of a file name as the first parameter. getimagesize``getimagesizefromstring

See the documentation for details on how this function works. getimagesize

stringThe image data, as a string.

image_info See . getimagesize

See . getimagesize

Voorbeeld: example

<?php
$img = '/path/to/test.png';

// Open as a file
$size_info1 = getimagesize($img);

// Or open as a string
$data       = file_get_contents($img);
$size_info2 = getimagesizefromstring($data);
?>

getimagesize