• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
image manipulation class - resize() maintain_ratio - not always!

#1
[eluser]PeteSig[/eluser]
Hi

I'm re-sizing some images & have set the
$config['maintain_ratio'] = TRUE;

if I set a height value & resize, the aspect ratio is maintained.
However, when I set a width value, then the aspect ratio is NOT maintained.

Here's my code, which is pretty much ripped from the user guide, so nothing complicated:
Code:
$config['image_library'] = 'gd2';
$config['source_image'] = $image;
$config['maintain_ratio'] = TRUE;
$config['height'] = 180;
$this->image_lib->initialize($config);
$this->image_lib->resize();
The above works fine.
Code:
$config['image_library'] = 'gd2';
$config['source_image'] = $image;
$config['maintain_ratio'] = TRUE;
$config['width'] = 320;
$this->image_lib->initialize($config);
$this->image_lib->resize();
The above doesn't keep aspect ratio.

Anyone else experienced this?
Is it a bug in CI or in the gd2 image lib, or am I not using it properly again?

Cheers

Pete


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.