Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BUG: Preserve alpha channel when cropping

This keeps the alpha channel from turning black.
  • Loading branch information...
commit bb30c1e590c531e12a9a7744f5cea09550407a03 1 parent 31bb601
Fred Condo authored
Showing with 5 additions and 0 deletions.
  1. +5 −0 filesystem/GD.php
View
5 filesystem/GD.php
@@ -264,6 +264,11 @@ public function rotatePixelByPixel($angle) {
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;
Please sign in to comment.
Something went wrong with that request. Please try again.