How to get the size of an image from a string with getimagesizefromstring() in PHP

1 Answer

0 votes
$data = file_get_contents('http://www.webshopy.com/images/webshopylogo.png');
$img_size = getimagesizefromstring($data);

echo "<pre>";
print_r($img_size);
echo "</pre>";



/*
run:

Array
(
    [0] => 276
    [1] => 110
    [2] => 3
    [3] => width="276" height="110"
    [bits] => 8
    [mime] => image/png
)


*/

 



answered Jun 23, 2016 by avibootz

Related questions

2 answers 259 views
3 answers 341 views
1 answer 251 views
1 answer 250 views
2 answers 226 views
...