CodeIgniter Forums
preserve transparence on image thumbnails - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: preserve transparence on image thumbnails (/showthread.php?tid=39111)



preserve transparence on image thumbnails - El Forum - 03-01-2011

[eluser]Unknown[/eluser]
FileConfusedystem/libraries/Image_lib.php Line:516

...
Code:
/* for PNG images*/
        if ($this->image_library == 'gd2' AND $this->image_type == 3)
        {
            imagealphablending($dst_img, false);
            $transparent = imagecolorallocatealpha($dst_img, 255, 255, 255, 127);
            imagefilledrectangle($dst_img, 0, 0, $this->width, $this->height, $transparent);
            imagesavealpha($dst_img,true);
        }

/* for GIF images */
        if ($this->image_library == 'gd2' AND $this->image_type == 1)
        {
            $transparent_index = imagecolortransparent($src_img);
            if ($transparent_index >= 0)
            {
                $transparent_color = imagecolorsforindex($src_img, $transparent_index);
                $transparent_index = imagecolorallocate($dst_img, $transparent_color['red'],
                                                              $transparent_color['green'],
                                                              $transparent_color['blue']);
                imagefill($dst_img, 0, 0, $transparent_index);
                imagecolortransparent($dst_img, $transparent_index);
            }
        }
...


preserve transparence on image thumbnails - El Forum - 03-01-2011

[eluser]steelaz[/eluser]
You should probably submit pull request on Bitbucket to get it implemented in core library.