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 was hoping someone could help me customize it so that it shrinks the image by 50% then crops the thumbnail from the center.
$file = 'image.jpg';
$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);