Jump to content

[SOLVED] Proportionally resizing images


play_

Recommended Posts

Consider the following scenario:

 

I allow users to upload images.

 

I don't want any image to be greater than 690 in width, and,

I don't want any image to be greater than 600 in height.

 

With that given, how can i proportionally resize an image if its width > 690 or if its height > 600?

 

Not exactly looking for code, but formulas for proportionally resizing the image.

All this with the GD lib.

 

Thanks!  :shy:

Link to comment
https://forums.phpfreaks.com/topic/177762-solved-proportionally-resizing-images/
Share on other sites

Thanks.

Although I couldn't find much help in that link, I did happen to figure out the formula.

 

ratio = w / h

 

so if we resize the image's width to 690, and want its height to be proportionally resized as well, we find the new height with 690 / ratio

 

:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.