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.. Quote Link to comment 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... Quote Link to comment 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.