Welcome Guest, Not a member yet? Register   Sign In
PNG and GIF images with transparent background turns black after rotate
#1

[eluser]Christophe28[/eluser]
Hello,

When I rotate a .png or .gif image with a transparent background, the background itself turns black (sometimes even blue or white) when using $this->image_lib->rotate();

I had the same problem before when resizing images. I tried to set gd2 to gd but that didn't help and makes the images a little messy after resize ...

Anybody any suggestions?

Thanks!

Christophe
#2

[eluser]Christophe28[/eluser]
After a long search on the internet I have found this 'solution' which brought me a bit further.

Code:
// I have comment out the line below and copy/paste everything else until the END MODIFICATION
        // $dst_img = $create($this->width, $this->height);
        
        /* TRANSPARENT PNG */
        $dst_img = imagecreatetruecolor($this->width, $this->height);
        $transparent = imagecolorallocatealpha($dst_img,0,255,0,127);
        imagefill($dst_img,0,0,$transparent);

        $copy($dst_img, $src_img, 0, 0, $this->x_axis, $this->y_axis, $this->width, $this->height, $this->orig_width, $this->orig_height);

        imageAlphaBlending($dst_img, false);
        imageSaveAlpha($dst_img, true);
// END MODIFICATION
After implementing this code in the systems image_lib (somewhere near line 515), PNG and GIF images with transparent background were OK after resizing, but for some reason not after rotating or watermarking ...

I would really appreciate some help. The more I search, the more confused I am Sad

Thx for ANY help!

Christophe




Theme © iAndrew 2016 - Forum software by © MyBB