note 106256 modified in function.imagecopyresampled by danbrown
| From: | danbrown@php.net | Date: | Fri, 21 Oct 2011 20:40:03 +0000 |
| Subject: | note 106256 modified in function.imagecopyresampled by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184061@lists.php.net to get a copy of this message | ||
A simple function that will crop xxx px from the bottom of the image.
<?php
function cropBottom($image,$bottom) {
list($width, $height) = getimagesize($image);
$img = imagecreatefromjpeg($image);
$crop = imagecreatetruecolor($width,$height-$bottom);
imagecopyresampled ( $crop, $img, 0, 0, 0, 0, $width, $height, $width, $height );
imagejpeg($crop,$image,85);
}
?>
--was--
A simple function that will crop xxx px from the bottom of the image.
function cropBottom($image,$bottom) {
list($width, $height) = getimagesize($image);
$img = imagecreatefromjpeg($image);
$crop = imagecreatetruecolor($width,$height-$bottom);
imagecopyresampled ( $crop, $img, 0, 0, 0, 0, $width, $height, $width, $height );
imagejpeg($crop,$image,85);
}
http://php.net/manual/en/function.imagecopyresampled.php