Merge pull request #1270 from oddnoc/gd-crop-preserve-alpha

BUG: Preserve alpha channel when cropping
This commit is contained in:
Ingo Schommer 2013-03-12 03:25:23 -07:00
commit 83b24285fa

View File

@ -264,6 +264,11 @@ class GDBackend extends Object implements Image_Backend {
public function crop($top, $left, $width, $height) {
$newGD = imagecreatetruecolor($width, $height);
// Preserve alpha channel between images
imagealphablending($newGD, false);
imagesavealpha($newGD, true);
imagecopyresampled($newGD, $this->gd, 0, 0, $left, $top, $width, $height, $width, $height);
$output = clone $this;