Skip to content

Commit

Permalink
For png images with transparency, the imagesaveaplpha() needs to be s…
Browse files Browse the repository at this point in the history
…et to true on the source image in order for the alpha to be preserved when using the modifier methods.
  • Loading branch information
jmwohl committed Apr 6, 2012
1 parent aebbb10 commit 797d526
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion filesystem/GD.php
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit 797d526

Please sign in to comment.