This example shows how to crop image in php gd.
This example shows how to crop image in php gd.<?php
$src = imagecreatefromjpeg('image1.jpg');
$dest = imagecreatetruecolor(80, 40);
imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);
header('Content-Type: image/jpeg');
imagegif($dest);
imagedestroy($dest);
imagedestroy($src);
?>
After running the program you will get the following output