getimagesizefromstring — Get image size information from a string.
array getimagesizefromstring ( string $imagedata [, array &$imageinfo ] )
Same as getimagesize() function. The difference is that the first parameter of getimagesizefromstring() is the string representation of the image data, not the file name.
parameter
imagedata: String representation of image data.
imageinfo: See getimagesize() function.
<?php$img = 'codercto-logo.png';//Open in file format $size_info1 = getimagesize($img);//Open in string format $data = file_get_contents($img);$size_info2 = getimagesizefromstring( $data);print_r($size_info2);?>
The output result of the above example is:
Array( [0] => 290 [1] => 69 [2] => 3 [3] => [bits] => 8 [mime] => image/png)