English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
getimagesizefromstring — Get image size information from a string.
array getimagesizefromstring ( string $imagedata[, array &$imageinfo ] )
Same getimagesize() Function. The difference is that getimagesizefromstring() takes the string representation of image data as the first parameter, not the filename.
Parameter
imagedata:String representation of image data.
imageinfo:See getimagesize() Function.
<?php $img = 'w3codebox-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] => width="290" height="69" [bits] => 8 [mime] => image/png )