mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
BUG: Preserve alpha channel when cropping
This keeps the alpha channel from turning black.
This commit is contained in:
parent
31bb60199e
commit
bb30c1e590
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user