![]() |
image_lib - resizing transparent png24 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: image_lib - resizing transparent png24 (/showthread.php?tid=7857) Pages:
1
2
|
image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]mandelkern[/eluser] Hi, I tried to resize a png-24 file with the codeigniter-image_lib, using GD2. The result looses its transparency and shows a black background. I couldn't find any solutions, fixing this within the image_lib. Can someone help me with this problem? Thanks. image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]Référencement Google[/eluser] Look at: http://ellislab.com/forums/viewthread/62955/#311374 Is this helping? image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]mandelkern[/eluser] Thanks, elite but I already tried this. It helps fine with gif and png-8 but my problem seems to be special with GD2 and png-24. image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]Référencement Google[/eluser] I posted the issue some time ago: http://ellislab.com/forums/viewthread/71962/ It is a CI bug and it looks like nobody has found a solution yet. You'll have to dive into the CI Image lib code and rework the GD part that make the transparency working. Sorry I can't help much more. image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]mandelkern[/eluser] Ok. Thanks anyway. I'll try my best :-) image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]Référencement Google[/eluser] If you find a solution please post it. image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]BorisK[/eluser] I had this same problem solved in PHP a while ago. Can you send me a link to a sample image that fails to work. If it keeps transparency in my code I'll port the hack to CI library. image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]mandelkern[/eluser] I found a solution at http://www.webdeveloper.com/forum/showthread.php?t=178210. Nearly at line 514 - $dst_img = $create($this->width, $this->height); I changed the code this way: //$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); ..and now it works. image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]Référencement Google[/eluser] Hey that's really cool, please report that + solution to the bug tracker of CI or to the forums bugs category image_lib - resizing transparent png24 - El Forum - 04-25-2008 [eluser]BorisK[/eluser] That's pretty similar to my PHP code, except that I refactored the ImageSetAlpha function: Code: function ResizeImage($newWidth, $newHeight) |