extrovertive Posted August 19, 2006 Share Posted August 19, 2006 Ok, I know how to have people upload a picture.Now, when they upload a picture, it will generate two versions - a porpotional thumbnail and the normal size pic they uploaded.The old way I'm doing is, let the people upload the pic (regardless of the size). When I output the pic - I have it be a fixed size of "width=90" and "height=90". Some pics look distorted that way. Now, I want to take the height and width attributes off the img tag and show the thumbnail generaed image instead and when they click the thumbnail, it will show the normal size pic.How can I do this? Link to comment https://forums.phpfreaks.com/topic/18052-help-with-picture-uploading-into-thumbnails/ Share on other sites More sharing options...
AndyB Posted August 19, 2006 Share Posted August 19, 2006 Here's a start to getting thumbnails created at upload timehttp://fundisom.com/phparadise/php/image_handling/image_upload_and_resize Link to comment https://forums.phpfreaks.com/topic/18052-help-with-picture-uploading-into-thumbnails/#findComment-77334 Share on other sites More sharing options...
extrovertive Posted August 19, 2006 Author Share Posted August 19, 2006 Thanks for the link.Only problem is, it works for JPEG only right?Plus, when I tried it on my localhost, it says the function imagecreatetruecolor was not found.So, I decided to use a cheap trick I found athttp://www.sitepoint.com/article/image-resizing-phpAll it does is resize the image by dimension and not by the filesize. Link to comment https://forums.phpfreaks.com/topic/18052-help-with-picture-uploading-into-thumbnails/#findComment-77393 Share on other sites More sharing options...
Yesideez Posted August 19, 2006 Share Posted August 19, 2006 That's similar to what I plan to use for my site:[code]<?php function imageresize($max_width,$max_height,$image) { $dimensions=getimagesize($image); $width_percentage=round($max_width/$dimensions[0]); $height_percentage=round($max_height/$dimensions[1]); if ($width_percentage<=$height_percentage) { $new_width=$width_percentage*$dimensions[0]; $new_height=$width_percentage*$dimensions[1]; } else { $new_width=$height_percentage*$dimensions[0]; $new_height=$height_percentage*$dimensions[1]; } $new_image=array($new_width,$new_height); return $new_image; }?>[/code] Link to comment https://forums.phpfreaks.com/topic/18052-help-with-picture-uploading-into-thumbnails/#findComment-77402 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.