summaryrefslogtreecommitdiffstats
path: root/system/libraries/Image_lib.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2010-08-20 17:28:22 +0200
committerDerek Jones <derek.jones@ellislab.com>2010-08-20 17:28:22 +0200
commit595bfd1484ecc8212d6c3c028210b4d1ae78baba (patch)
tree2c757435893023372d6c501e55d96023d5d5a6da /system/libraries/Image_lib.php
parent5eb964f7bcda04c13cc484cfdef7138e887a75f3 (diff)
Added ability in the Image Library to handle PNG transparency for resize operations when using the GD lib.
Diffstat (limited to 'system/libraries/Image_lib.php')
-rw-r--r--system/libraries/Image_lib.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 21e0a709b..806d942ba 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -513,6 +513,13 @@ class CI_Image_lib {
}
$dst_img = $create($this->width, $this->height);
+
+ if ($this->image_type == 3) // png we can actually preserve transparency
+ {
+ imagealphablending($dst_img, FALSE);
+ imagesavealpha($dst_img, TRUE);
+ }
+
$copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);
// Show the image