Source: thumbgen.phps - download
<?php
$im = $_GET['im'];
$new_width = (int)$_GET['w'];
$new_height = (int)$_GET['h'];
$image = @imagecreatefromjpeg($im) or die('Error open image '.$im);
$width = imagesx($image);
$height = imagesy($image);
$new_width = ($new_width>$width)?$width:$new_width;
$new_height = ($new_height>$height)?$height:$new_height;
$image_thumb = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_thumb, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
header('Content-type: image/jpeg');
imagejpeg($image_thumb);
//useage thumbgen.php?im=imagefile.jpg&w=200&h=200
?>