开发者

Resizing PNG in CodeIgniter while preserving the transparency

开发者 https://www.devze.com 2023-03-14 01:53 出处:网络
I\'m using this code to resize images in CodeIgniter $config[\'image_library\'] = \'gd2\'; $config[\'source_image\'] = $tempFile;

I'm using this code to resize images in CodeIgniter

$config['image_library'] = 'gd2';
$config['source_image'] = $tempFile;
$config['create_thumb'] = TRUE;开发者_如何学C
$config['maintain_ratio'] = TRUE;
$config['width'] = 70 / $ratio;
$config['height'] = 70;
$config['thumb_marker'] = '';
$this->load->library('image_lib', $config);
$this->image_lib->resize();

But when I upload png files the transparent area is getting black. I need to make the resized image transparent. Please help me.


Three first results in google: http://www.akemapa.com/2008/07/10/php-gd-resize-transparent-image-png-gif/ http://www.phpfreaks.com/forums/index.php?topic=232090.0 How to preserve transparency when resizing PNG using Perl and GD

Specific for CI: http://codeigniter.com/forums/viewthread/62955/


Above link is dead since CI got moved. New link here: http://forum.codeigniter.com/thread-7857.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号