• Crop An Image With the PHP GD Library

    Kindly find the code for Crop an image with the PHP GD Library.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    
     
    <?php
    // Create image instances
    $src = imagecreatefromgif('php.gif');
    $dest = imagecreatetruecolor(80, 40);
     
    // Copy
    imagecopy($dest, $src, 0, 0, 20, 13, 80, 40);
     
    // Output and free from memory
    header('Content-Type: image/gif');
    imagegif($dest);
     
    imagedestroy($dest);
    imagedestroy($src);
    ?>

    Hope you enjoyed!

Comments on this post

Leave a Reply

  • Security Code :


    + six = 8