Welcome Guest, Not a member yet? Register   Sign In
Image Manipulation: Resizing / Watermarking -> Weird Results
#1

[eluser]Unknown[/eluser]
hey guys,

what we are trying to do on our new website http://www.erfahrungen.com/ - resizing a big picture to max 88px width or max 31px height and put it on a 88x31px transparent background file to make sure the manipulated image is exactly 88x31px.

it works basically, but it's not transparent anymore -> white background instead. and the image looks weird. example: before http://i.imm.io/yTgR.gif after http://i.imm.io/yThc.png

Code:
$config['image_library'] = 'gd2';
                $config['source_image'] = './images/products/'.$CI->session->userdata('filename');
                $config['create_thumb'] = FALSE;
                $config['width'] = 88;
                $config['height'] = 31;
                $config['quality'] = 100;

                $CI->load->library('image_lib', $config);
                $image = getimagesize('./images/products/'.$CI->session->userdata('filename'));

                if($image[0]>88 || $image[1]>31){
                    $CI->image_lib->resize();
                    $config['source_image']    = './images/products/transparent.png';
                $config['quality'] = 100;
                $config['wm_type'] = 'overlay';
    
                $config['wm_opacity'] = 100;
                $config['wm_overlay_path'] = './images/products/'.$CI->session->userdata('filename');
                $config['wm_vrt_alignment'] = 'bottom';
                $config['wm_hor_alignment'] = 'center';

                $CI->image_lib->initialize($config);

                $CI->image_lib->watermark();
                unlink("./images/products/".$CI->session->userdata('filename'));
                rename('./images/products/transparent.png', './images/products/'.$CI->session->userdata('filename'));
                copy('./images/products/transparent2.png','./images/products/transparent.png');

can you guys help please?

thanks in advance
OneGuy
#2

[eluser]Unknown[/eluser]
btw, I tried it with a transparent gif and png file. the above result is with a png, it's not working with a gif file.




Theme © iAndrew 2016 - Forum software by © MyBB