function imagezoom(&$im,$x1,$y1,$x2,$y2,$ratio)
{
$new = imagecreate(($x2-$x1),($y2-$y1));
$zoomed = imagecreate((int)($ratio($x2-$x1)),(int)($ratio($y2-$y1)));
$copy = imagecopy($new,$im,0,0,$x1,$y1,($x2-$x1),($y2-$y1));
imagedestroy($im);
$im = imagecreate((int)($ratio($x2-$x1)),(int)($ratio($y2-$y1)));
$resize = imagecopyresized($im,$new,0,0,0,0,(int)($ratio($x2-$x1)),(int)($ratio($y2-$y1)),(int)($x2-$x1),(int)($y2-$y1));
imagedestroy($new);
}
look at the manual to suss out the individual functions.
example use ;
$ratio = .25;
$img = imagecreatefromjpeg($userfile);
$imageInfo = getimagesize($userfile);
$width = $imageInfo[0];
$height = $imageInfo[1];
imagezoom($img,0,0,$width,$height,$ratio);
ImageJPEG($img,$targetdir."/".$thumbnailname);
imagedestroy($img);