Welcome Guest, Not a member yet? Register   Sign In
Preserving transparency when creating thumbnails
#1

[eluser]Unknown[/eluser]
Hey Everyone,

Long time lurker, first time poster Wink

I was wondering if I am missing something or if the Image manipulation class doesn't preserve png transparency when resizing and thumbnail and directly outputting it? I just end up with a black background. Using the GD2 library, here is the relevant code, that works fine (except for the transparency bit):
Code:
function index($image, $max_height=null, $max_width = null)
    {
        $filename = 'system/application/backup/photos/'.$image;
        $config['image_library'] = 'GD2';
        $config['source_image'] = $filename;
        $config['width'] = (is_numeric($max_width) && $max_width != 0 ? $max_width : '');
        $config['height'] = (is_numeric($max_height) && $max_height != 0 ? $max_height : '');
        $config['dynamic_output'] = TRUE;
        $config['maintain_ratio'] = TRUE;
        
        $this->load->library('image_lib', $config);
        
        if(!$this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();
        }
    }

Any advice much appreciated.


Messages In This Thread
Preserving transparency when creating thumbnails - by El Forum - 10-02-2009, 04:03 AM
Preserving transparency when creating thumbnails - by El Forum - 10-02-2009, 01:50 PM



Theme © iAndrew 2016 - Forum software by © MyBB