play_ Posted October 15, 2009 Share Posted October 15, 2009 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! Link to comment https://forums.phpfreaks.com/topic/177762-solved-proportionally-resizing-images/ Share on other sites More sharing options...
redarrow Posted October 15, 2009 Share Posted October 15, 2009 http://kobesearch.cpan.org/htdocs/Image-Resize/Image/Resize.html link provided will help. Link to comment https://forums.phpfreaks.com/topic/177762-solved-proportionally-resizing-images/#findComment-937325 Share on other sites More sharing options...
play_ Posted October 15, 2009 Author Share Posted October 15, 2009 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 Link to comment https://forums.phpfreaks.com/topic/177762-solved-proportionally-resizing-images/#findComment-937661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.