mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-07-01 17:09:38 +02:00
Merge pull request #1270 from oddnoc/gd-crop-preserve-alpha
BUG: Preserve alpha channel when cropping
This commit is contained in:
commit
83b24285fa
|
@ -264,6 +264,11 @@ class GDBackend extends Object implements Image_Backend {
|
||||||
|
|
||||||
public function crop($top, $left, $width, $height) {
|
public function crop($top, $left, $width, $height) {
|
||||||
$newGD = imagecreatetruecolor($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);
|
imagecopyresampled($newGD, $this->gd, 0, 0, $left, $top, $width, $height, $width, $height);
|
||||||
|
|
||||||
$output = clone $this;
|
$output = clone $this;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user