cs.punk Posted June 14, 2009 Share Posted June 14, 2009 I can't figure out a good way of showing my users profile pictures in a minimum size of example 320x200,but to keep the aspect ratio intact and maybe user 'blocks' to fill out the empty space.(i've attached a image example' How do you deal with it? Secondly, with each photo being up to 2MB in size, is there a way to load the '320x200' image only rather than a 'squashed' image of the full image? I use the following code: <img src='../file_uploads/$profile_pic' height='320' width='200'/> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/162160-how-to-keep-a-photos-aspect-ratio-but-keep-it-in-a-minimum-size-320x200/ Share on other sites More sharing options...
haku Posted June 15, 2009 Share Posted June 15, 2009 You can't do this with HTML. You need to use a serverside language like php to resize the picture on upload, and display it that way. And in fact that's definitely what you should do, because if you are showing the user a 'squashed' version of the image, your web pages are going to take significantly longer to download than they need to, as the user will be downloading images larger than they are actually seeing. Quote Link to comment https://forums.phpfreaks.com/topic/162160-how-to-keep-a-photos-aspect-ratio-but-keep-it-in-a-minimum-size-320x200/#findComment-855949 Share on other sites More sharing options...
cs.punk Posted June 16, 2009 Author Share Posted June 16, 2009 Ok so, once I get php to resize it to less than 320x200, If i have a image of 320x126 or 240x200, How do I 'center' it in a borderless box of somesort? Quote Link to comment https://forums.phpfreaks.com/topic/162160-how-to-keep-a-photos-aspect-ratio-but-keep-it-in-a-minimum-size-320x200/#findComment-857407 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.