file dove compare la foto :

echo"<img border=0 src=\"resize.php?file=".$nomefile."&altezza=".$rig aopzioni[altezzafoto_fotogallery]."&larghezza=".$rigaopzioni[larghezzafoto_fotogallery]."\">";

file resize.php

$file=$_GET[file];

$hsize =$_GET['altezza'];
$wsize =$_GET['larghezza'];


$im_size = GetImageSize($file);
$imageWidth = $im_size[0];
$imageHeight = $im_size[1];
$thumb_width = $wsize;
$thumb_height = $hsize;
$im2 = ImageCreateFromJPEG($file);

if ($imageWidth>=$imageHeight) {
$width = $thumb_width;
$height = ($width/$imageWidth)*$imageHeight;
} else {
$height = $thumb_height;
$width = ($height/$imageHeight)*$imageWidth;
}
$im = imageCreateTrueColor($width, $height);

if (function_exists('ImageCopyResampled')) {
ImageCopyResampled($im,$im2, 0, 0, 0, 0, $width, $height, $imageWidth, $imageHeight);
} else {
ImageCopyResized($im,$im2, 0, 0, 0, 0, $width, $height, $imageWidth, $imageHeight);
}

Header("Content-type: image/jpg");
Imagejpeg($im, '', 85); //85 è la qualità (da 1 a 100)
ImageDestroy($im);
ImageDestroy($im2);