here is a snipped of code i use to create thumbs.
PHP Code:
list($width, $height) = getimagesize($filename);
// get the pecent needed to reduce the image height to 56 pixels
$percent = (100 * 56 / $height) * .01;
// set thumb size
$new_width = $width * $percent;
$new_height = $height * $percent;
// resample image
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
$newfile = "/path/to/images/gallery/".$image_id.".jpg";
move_uploaded_file($filename, $newfile);
chmod($newfile, 0644);
$array = explode(".",$name);
imagejpeg($image_p, "/path/to/images/gallery/".$image_id."_t.jpg");