1

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.

Mazhar Ahmed
  • 1,523
  • 2
  • 24
  • 41

2 Answers2

3

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

nizzle
  • 1,036
  • 2
  • 10
  • 23
3

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/

Community
  • 1
  • 1
Shay Ben Moshe
  • 1,298
  • 3
  • 12
  • 27