在 CodeIgniter 中调整 PNG 大小,同时保留透明度
我正在使用此代码来调整 CodeIgniter 中的图像大小,
$config['image_library'] = 'gd2';
$config['source_image'] = $tempFile;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 70 / $ratio;
$config['height'] = 70;
$config['thumb_marker'] = '';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
但是当我上传 png 文件时,透明区域会变黑。 我需要使调整大小的图像透明。请帮我。
I'm using this code to resize images in CodeIgniter
$config['image_library'] = 'gd2';
$config['source_image'] = $tempFile;
$config['create_thumb'] = TRUE;
$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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
谷歌的三个第一结果:
http://www.akemapa .com/2008/07/10/php-gd-resize-transparent-image-png-gif/
http://www.phpfreaks.com/forums/index.php?topic= 232090.0
如何使用 Perl 和 调整 PNG 大小时保留透明度GD
特定于 CI:
http://codeigniter.com/forums/viewthread/62955/
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/
自从 CI 移动后,上面的链接就失效了。新链接在这里:
http://forum.codeigniter.com/thread-7857.html
Above link is dead since CI got moved. New link here:
http://forum.codeigniter.com/thread-7857.html