vineld Posted July 29, 2009 Share Posted July 29, 2009 What method do you use if you want to automatically resize an uploaded image to any given format (that fits within it of course but isn't necessarily of the same proportions)? What I do right now is that I simply check to see what proportions the original image has compared to the one I want to create. Depending on this I start by shrinking it down along either the x or y axis. I now have an image which is either as high or as wide as the one I want. Next I simply cut the middle part of the image since focus is usually in the center of photos. This seems to work well in most cases for "horizontal" images although not always as well for higher "vertical" ones. Are there any other better methods of doing this? Note: This is not about simply resizing a photo, cropping needs to be done as well, unless the proportions happen to be the same. Quote Link to comment https://forums.phpfreaks.com/topic/167894-automatically-resizing-an-image-to-any-format/ Share on other sites More sharing options...
corbin Posted July 29, 2009 Share Posted July 29, 2009 Well, you could always allow your user to choose.... The only other option I can think of is the way you're currently doing it. Or you could squish the image. Quote Link to comment https://forums.phpfreaks.com/topic/167894-automatically-resizing-an-image-to-any-format/#findComment-885624 Share on other sites More sharing options...
vineld Posted July 29, 2009 Author Share Posted July 29, 2009 Thanks, at least I'm not way off Yeah, letting the user choose himself is the optimal solution but for some sites I have had thousands of photos that needs to be resized and it's too time consuming to handle them manually. Quote Link to comment https://forums.phpfreaks.com/topic/167894-automatically-resizing-an-image-to-any-format/#findComment-886391 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.