BUG: Preserve alpha channel when cropping

This keeps the alpha channel from turning black.
This commit is contained in:
Fred Condo 2013-03-11 15:19:09 -07:00
parent 31bb60199e
commit bb30c1e590

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;