Splash Posted July 26, 2007 Share Posted July 26, 2007 Hi all I'm trying to set up a script that will generate thumbnails for an image gallery using GD Library. I'm using the following script, which resizes the image to 100px x 100px. It's working fine however I has hoping someone could help me edit it so that it shrinks the image by 50% then crops the thumbnail from the center. <?php //Input file $file = 'image.jpg'; //Output file $save = 'new.jpg'; //Get image dimensions list($width, $height) = getimagesize($file) ; //Set new Dimensions $modwidth = 100; $modheight = 100; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100); ?> Thanks a lot 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.