I have 2 variables available about a photo i’m importing, width and height.(I could use imagesx etc, but i’m importing in bulk and it takes way too long)
eg..
$w = 720;
$h = 540;
How can I workout the correct height for the photo if I say the max width is 180px, I know the correct height should be 135px (on a standard landscape photo). But the starting width and height i’m given will change depending on the photo.
Keeping the image in proportion what calculation do I need to do to workout the reduced width and height?
Final result will be in pixels so can not have any decimal places.
(I do not actually need to re-size the photo, just calculate the size.)
Thanks in advance 🙂
It is a simple cross-multiplying rule. Then round the numbers to get rid of the decimal portion.