Skip to content
This repository
Browse code

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...
commit 797d526c60865cc8b9ccfaf9454ea4ee83f2e041 1 parent aebbb10
jmwohl authored April 06, 2012

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. 7  filesystem/GD.php
7  filesystem/GD.php
@@ -30,7 +30,12 @@ function __construct($filename = null) {
30 30
 			switch($type) {
31 31
 				case 1: if(function_exists('imagecreatefromgif')) $this->setGD(imagecreatefromgif($filename)); break;
32 32
 				case 2: if(function_exists('imagecreatefromjpeg')) $this->setGD(imagecreatefromjpeg($filename)); break;
33  
-				case 3: if(function_exists('imagecreatefrompng')) $this->setGD(imagecreatefrompng($filename)); break;
  33
+				case 3: if(function_exists('imagecreatefrompng')) {
  34
+					$img = imagecreatefrompng($filename);
  35
+					imagesavealpha($img, true); // save alphablending setting (important)
  36
+					$this->setGD($img);
  37
+					break;
  38
+				}
34 39
 			}
35 40
 		}
36 41
 		

0 notes on commit 797d526

Please sign in to comment.
Something went wrong with that request. Please try again.