PHP Example
Screen shot
Screen shot
PHP script to create thumbnail of jpg image

<?php
$image_name=\"img1.jpg\";

//copy orginal image and store in thumbnail folder
copy(\"images/\".$image_name,\"thumbnail/\".$image_name);

$myimage=imagecreatefromjpeg(\"thumbnail/\".$image_name);

$mainwidth=imagesx($myimage);
$mainheight=imagesy($myimage);


$thumbwidth=intval($mainwidth/2);
$thumbheight=intval($mainheight/2);

//create thumbnail image
$mythumbnail=imagecreatetruecolor($thumbwidth,$thumbheight);

imagecopyresampled($mythumbnail,$myimage,0,0,0,0,$thumbwidth,
$thumbheight,$mainwidth,$mainheight);


header(\"content-type:image/jpeg\");

//overwrite new thumbnail image to thumbnail folder
imagejpeg($mythumbnail,\"thumbnail/\".$image_name);

imagedestroy($mythumbnail);
imagedestroy($myimage);
?>

You can download source code here