From 797d526c60865cc8b9ccfaf9454ea4ee83f2e041 Mon Sep 17 00:00:00 2001 From: jmwohl Date: Fri, 6 Apr 2012 11:19:30 -0300 Subject: [PATCH] For png images with transparency, the imagesaveaplpha() needs to be set to true on the source image in order for the alpha to be preserved when using the modifier methods. --- filesystem/GD.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/filesystem/GD.php b/filesystem/GD.php index 16eccff93..4edd9ddfa 100644 --- a/filesystem/GD.php +++ b/filesystem/GD.php @@ -30,7 +30,12 @@ class GD extends Object { 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; + } } }