PHP GD copy of image


 

PHP GD copy of image

This example shows how to copy an image using php gd library.

This example shows how to copy an image using php gd library.

<?php

$src = imagecreatefromjpeg('images.jpg');

$dest = imagecreatetruecolor(80, 40);

imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);

header('Content-Type: image/jpeg');

imagejpeg($dest);

imagedestroy($dest);

imagedestroy($src);

?>

After running the program you will get the following output

Ads