First create a new image.
Then crop the current image and copy it to the new image.
That does it for both the cropping and resizing.
//output content header
//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
I hope the code is right. I didn't test it. Just typed quickly.