Browse files

For png images with transparency, the imagesaveaplpha() needs to be s…

…et to true on the source image in order for the alpha to be preserved when using the modifier methods.
  • Loading branch information...
1 parent aebbb10 commit 797d526c60865cc8b9ccfaf9454ea4ee83f2e041 @jmwohl jmwohl committed Apr 6, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 filesystem/GD.php
View
7 filesystem/GD.php
@@ -30,7 +30,12 @@ function __construct($filename = null) {
switch($type) {
case 1: if(function_exists('imagecreatefromgif')) $this->setGD(imagecreatefromgif($filename)); break;
case 2: if(function_exists('imagecreatefromjpeg')) $this->setGD(imagecreatefromjpeg($filename)); break;
- case 3: if(function_exists('imagecreatefrompng')) $this->setGD(imagecreatefrompng($filename)); break;
+ case 3: if(function_exists('imagecreatefrompng')) {
+ $img = imagecreatefrompng($filename);
+ imagesavealpha($img, true); // save alphablending setting (important)
+ $this->setGD($img);
+ break;
+ }
}
}

0 comments on commit 797d526

Please sign in to comment.