I have an url to the image, like $var = http://site.com/image.png
How do I get its dimensions to an array, like array([h]=> 200, [w]=>100)
(height=200, with=100)
?
I have an url to the image, like $var = http://site.com/image.png
How do I get its dimensions to an array, like array([h]=> 200, [w]=>100)
(height=200, with=100)
?
You can use the getimagesize
function like this:
list($width, $height) = getimagesize('path to image');
echo "width: $width <br />";
echo "height: $height";
<?php
list($width, $height) = getimagesize("http://site.com/image.png");
$arr = array('h' => $height, 'w' => $width );
?>