Here is the code I use to create thumbnails as I upload files to the server using a form.
// frontpic is the name of my file input field
$front = strtolower($frontpic_name);
// copies image and gets the size
@copy("$frontpic", "/home/path/$front");
@$size = GetImageSize("/home/path/$front");
//this creates a temp image from JPEG... you can also do from GIF and i think PNG too
@$source_id = imageCreateFromJPEG("/home/path/$front");
//the size i want to use for my thumb
$dest_x = 45;
$dest_y = 62;
// creates thumbnail
@$target_id = imagecreatetruecolor($dest_x, $dest_y);
@$target_pic = imagecopyresampled($target_id,$source_id, 0, 0, 0, 0, $dest_x, $dest_y, $size[0],$size[1]);
// 75 is the quality i use where 100 is the best
@imagejpeg($target_id,"/home/path/thumb_$front", 75);