PHP getimagesizefromstring - Get Image Information Function
getimagesizefromstring — Get image size information from a string.
Syntax
array getimagesizefromstring ( string $imagedata [, array &$imageinfo ] )
samegetimagesize()Function. The difference is that the first parameter of getimagesizefromstring() is a string representation of the image data, rather than a filename.
Parameters
- imagedata:A string representation of the image data.
- imageinfo:See alsogetimagesize()Function.
Example
<?php $img = 'example-logo.png'; // 以文件方式打开 $size_info1 = getimagesize($img); // 以字符串格式打开 $data = file_get_contents($img); $size_info2 = getimagesizefromstring($data); print_r($size_info2); ?>
The output of the above example is:
Array
(
[0] => 290
[1] => 69
[2] => 3
[3] => width="290" height="69"
[bits] => 8
[mime] => image/png
)
Other Extensions
PHP Image Processing