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
精彩评论