-2

How can you tell the dimensions of a .jpeg or .png file without opening it?

If it is impossible to determine the dimensions, how can I automatically crop an image?

I am using PHP and JS.

Don P
  • 60,113
  • 114
  • 300
  • 432

1 Answers1

1
list($width, $height) = getimagesize("img.jpg");
      or

$im=imagecreatefromjpeg("image_testin_1.JPG");
imagetruecolortopalette($im, false, 255);

$w = imagesx($im);//provide width of full page
$h = imagesy($im);//provide height of full page
Ankur Saxena
  • 629
  • 3
  • 13
  • 26