Hello,
I'm not an ImageMagick expert, but usually it's not a good idea to resize images solely with PHP + GD 1.x The GD library prior to 2 doesn't support ImageCopyResampled, and the ImageCopyResized gives bad results.
So this solution solution applies only to PHP + GD 2.x. It get's image from $input_file (for example from upload), and saves the thumbnail in $output_file. It uses JPEG format and it constraints proportions, but it's really easy to use different formats too.
<?
// thumbnail sizes
$thumb_max_width = 100;
$thumb_max_height = 100;
$thumb_quality = 90;
// read image size
$size = getimagesize($input_file);
// read the input file
$input_image = imagecreatefromjpeg($input_file);
// compute ratio
$ratio = min($thumb_max_width,$size[0],$thumb_max_height/$size[1]);
// create output image
$output_image = ImageCreate(round($size[0] $ratio),round($size[1] $ratio));
// resample image
// when using GD 1.x change this to imagecopyresized
imagecopyresampled($output_image, $input_image, 0, 0, 0, 0, round($size[0] $ratio), round($size[1] $ratio), $size[0], $size[1]);
// create output image
imagejpeg($output_image,$output_file,$thumb_quality);
imagedestroy($input_image);
imagedestroy($output_image);
?>
Tomas