arbitter Posted February 24, 2010 Share Posted February 24, 2010 I have this site, and momentarely the pictures are way to heavy to have to load every time. http://www.fransdepypere.be/uploads/uploads.php?month=February10&sort=ksort for example. (I'm not trying to lure people to my site, don't have any ads or anything) Since it's meant to be a site for my grandfather, it's not really that good because his internet is veeeery slooooow. So I'd need to make thumbnails of the pictures uploaded. But what would be the good width? Another advantage of doing this is I wouldn't need the max-width attribute that doesn't work that fine with IE. What would be the good maximum width in pixels for my site, you think? I've searched for some scripts but I don't really find what I like. As a matter of fact, if there's a part about renaming the new file, that isn't neccesary because I only need the thumbnails on my server. I know it's a lot to ask, but i hope someone will give some good advice.. Link to comment https://forums.phpfreaks.com/topic/193202-thumbnails-pictures-uploaded/ Share on other sites More sharing options...
arbitter Posted February 24, 2010 Author Share Posted February 24, 2010 So I have function resizeImage($originalImage,$toWidth,$toHeight){ // Get the original geometry and calculate scales list($width, $height) = getimagesize($originalImage); $xscale=$width/$toWidth; $yscale=$height/$toHeight; // Recalculate new size with default ratio if ($yscale>$xscale){ $new_width = round($width * (1/$yscale)); $new_height = round($height * (1/$yscale)); } else { $new_width = round($width * (1/$xscale)); $new_height = round($height * (1/$xscale)); } // Resize the original image $imageResized = imagecreatetruecolor($new_width, $new_height); $imageTmp = imagecreatefromjpeg ($originalImage); imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height); return $imageResized; } But then I don't really know what to do... Link to comment https://forums.phpfreaks.com/topic/193202-thumbnails-pictures-uploaded/#findComment-1017389 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.