Say we have an image (760px*1100px), but we want to resize that image into a 300px*300px box. Just making the image 300px*300px would distort the image, so we have to 'constrain' it's proportions, but I am unsure on how to do this.

My logic goes like this:

- Find images largest dimension (this case: height = 1100px)
- Find what percent 300 is of 1100px ((300 / 1100) * 100?)
- ... here is where my logic ends.

Any ideas? Is my math for working the percentage out correct? .. and would I then just apply this percentage to working out the smaller dimension?