eSnippets.net, a code gallery for creating, saving and sharing all kinds of code snippets.

Get Width/Height of Image — PHP

Posted On: Saturday, May 10, 2014 at 9:55 AM

If all you have for an image is the URL, you can still find the dimensions.

<?php

list($width, $height, $type, $attr) = getimagesize("url/to/image.jpg");

echo "Image width " . $width;
echo "Image height " . $height;
echo "Image type " . $type;
echo "Attribute " . $attr;

?>

You need to be logged in to comment! x

rpjs

Joined on Saturday, May 3, 2014
Contributed 29 Snippets

Get Social and Share

Tags