This example allow to use every kind of image and to resize images with ImageCopyResized(), maintaining proportions..
<?php
$imgfile = 'namefile.jpg';
Header("Content-type: image/".$_GET["type"]);
switch($_GET["type"]){
default:
$function_image_create = "ImageCreateFromJpeg";
$function_image_new = "ImageJpeg";
break;
case "jpg":
$function_image_create = "ImageCreateFromJpeg";
$function_image_new = "ImageJpeg";
case "jpeg":
$function_image_create = "ImageCreateFromJpeg";
$function_image_new = "ImageJpeg";
break;
case "png":
$function_image_create = "ImageCreateFromPng";
$function_image_new = "ImagePNG";
break;
case "gif":
$function_image_create = "ImageCreateFromGif";
$function_image_new = "ImagePNG";
break;
}
list($width, $height) = getimagesize($imgfile);
$newheight = 80;
$newwidth = (int) (($width*80)/$height);
$thumb = ImageCreateTrueColor($newwidth,$newheight);
$source = @function_image_create($imgfile);
ImageCopyResized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
@$function_image_new($thumb);
?>