Get Width/Height of Image

Avatar of Chris Coyier
Chris Coyier on

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;

?>