How to find out image auto height if the desired width is 1024 in PHP from any sized image?

109 views Asked by At

I have an image with an example dimension of 1600x1200, i would like to resize it down to width: 1024 using PHP.

How do i calculate the height if i only know the desired width?

I know this works on the command line but it calculates the height for me:

mogrify -resize 1024 someimage.jpg

I am looking to calculate the height in code since php doesn't have any functions that do it for you and they all require the height to be specified.

Thanks

0

There are 0 answers