Home Tutorial Php Phpgd PHP GD crop image

 
 

PHP GD crop image
Posted on: November 3, 2009 at 12:00 AM
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

Related Tags for PHP GD crop image: