thumbnail.php
<?php
set_time_limit(0);
header("Content-type:image/jpeg");
// get image size
$file = $_GET[image];
if($size = GetImageSize($file)){
$w = $size[0];
$h = $size[1];
//set new size
$nw = $_GET['width'];
$nh = ($nw*$h)/$w;
}
else{
//set new size
$nw = "0";
$nh = "0";
}
//Now let's draw the image:
//draw image
$src_img = imagecreatefromjpeg($file);
$dst_img = imagecreatetruecolor($nw,$nh);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h);
imagejpeg($dst_img,"",100);
imagedestroy($src_img);
imagedestroy($dst_img);
?>