RsD0p9BK
6/24/2015 - 8:35 AM

cropImage.php

// How can I cut an image from the bottom using PHP
// http://stackoverflow.com/questions/2326462/how-can-i-cut-an-image-from-the-bottom-using-php

$in_filename = 'source.jpg';

list($width, $height) = getimagesize($in_filename);

$offset_x = 0;
$offset_y = 0;

$new_height = $height - 15;
$new_width = $width;

$image = imagecreatefromjpeg($in_filename);
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopy($new_image, $image, 0, 0, $offset_x, $offset_y, $width, $height);

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