First create a new image.
Then crop the current image and copy it to the new image.
PHP Code:
//output content header
header("Content-type: image/gif");
//create a new true color image with 64px width and height
$newImage = imagecreatetruecolor(64, 64);
//put the original image into memory as a variable
$oldImage = imagecreatefromgif("imagefilename.gif");
//crop the original image at 400 by 400
//copy the cropped part to a 64 by 64 part onto the $newImage
imagecopyresampled($newImage, $oldImage, 0, 0, 0, 0, 64, 64, 400, 400);
//output the new image by type
imagegif($newImage);
That does it for both the cropping and resizing.
I hope the code is right. I didn't test it. Just typed quickly.
Bookmarks