0

The resolution of this image is 3000*4000. width = 3000 and Height = 4000. url- https://ibb.co/0mKkWYD

getimagesize returning the height first because it is larger than width. So the resolution becomes 4000*3000, where the actual is 3000*4000. I need to know which is width and which is height. Is there any way?

  • The first index of the result of `getimagesize()` is `3000` for that image. Please [edit] your question to include a [mcve], which shows the incorrect width/height of the image you have. – Progman Nov 10 '21 at 09:57

2 Answers2

1

From the documentation https://www.php.net/manual/en/function.getimagesize.php:

Return Values

Returns an array with up to 7 elements. Not all image types will include the channels and bits elements.

Index 0 and 1 contains respectively the width and the height of the image.

Chizaram Igolo
  • 907
  • 8
  • 18
0

you can try like this.

list($width, $height) = getimagesize('IMG-20211026-170113.jpg');

echo $width;

echo $height;

this will give you width and height separately

Bhanu Pratap
  • 144
  • 6
  • It's not a solution. I already tested like this. It will print width= 4000 and then height= 3000. But the actual is width= 3000 and then height= 4000. test yourself what happens. I think it's a bug of php. – Tanvir Ahmed Nov 10 '21 at 05:17
  • I have tried this and this give me the correct width and height of your attached image. try once again paste the code same and enter the correct image path than let me know if not working – Bhanu Pratap Nov 10 '21 at 05:19