PHP קוד:
<?php
$filename = "file";
header('Content-type: image/jpeg');
$newwidth = "width";
$newheight = "height";
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb);
?>
זו הדוגמה.
משתמשים בפונקציה imagecopyresized.