获取图片的宽度/高度

Avatar of Chris Coyier
Chris Coyier

如果您只有图片的 URL,您仍然可以找到其尺寸

<?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;

?>