Basically, I have an image which could be large (couple of thousand pixels in both height and width), and can vary quite a bit in width’s and height’s.
What I need to do is display these images at approximately 500 pixels in height and width – but I want to keep the aspect ratio of these intact, so the values would just be fairly close. But I’m a bit confused on what calculations I could use on the original width’s and heights to get them to the right figures.
Any ideas?
Try this:
Of course simply set original variable to your images size and determine your resize percentage. You could calculate the resize percentage if you had a target width like this: