dai un'occhiata a questo

codice:
<?
function resize_img($imgname,$size)
{
Header("Content-Type: image/jpeg");
$img_src = ImageCreateFromjpeg ($imgname);

$true_width = imagesx($img_src);
$true_height = imagesy($img_src);

if ($true_width>=$true_height)
{
$width=$size;
$height = ($width/$true_width)*$true_height;
}
else
{
$height=$size;
$width = ($height/$true_height)*$true_width;
}
$img_des = ImageCreateTrueColor($width,$height);
imagecopyresampled ($img_des, $img_src, 0, 0, 0, 0, $width, $height, $true_width, $true_height);
return $img_des;
}
//PERCORSI OK
if (file_exists("htmlarea/risorse/$imm.jpg"))
{
$picture_location="htmlarea/risorse/$imm.jpg";// picture locarion
}
else
{
$picture_location="images/bianca.jpg"; 
}
$picture_save="risorse/$imm.jpg"; // picture save location

$size=89; // thumbnail size (pixels)

$img_des=resize_img($picture_location,$size);

# to display thumbnail, type this :
imagejpeg($img_des);
# OR
# use this to save picture :
# imagejpeg($img_des,$picture_save);
# OR
# U can show thumbnail and
# save thumbnail to a file together :
# imagejpeg($img_des);
# imagejpeg($img_des,$picture_save);
# imagejpeg($img_des); // only thumbnail picture
?>