PHP getimagesizefromstring - Get image info function
PHP getimagesizefromstring - Get image info function
getimagesizefromstring - Get image size information from a string.
grammar
array getimagesizefromstring ( string $imagedata [, array &$imageinfo ] )
With getimagesize () function. The difference is getimagesizefromstring () The first parameter is the string representation of the image data, not the file name.
parameter
- imagedata: a string representation of the image data.
- imageinfo: See also getimagesize () function.
Examples
<?php $img = 'w3big-logo.png'; // 以文件方式打开 $size_info1 = getimagesize($img); // 以字符串格式打开 $data = file_get_contents($img); $size_info2 = getimagesizefromstring($data); print_r($size_info2); ?>
The above example output is:
Array ( [0] => 290 [1] => 69 [2] => 3 [3] => width="290" height="69" [bits] => 8 [mime] => image/png )