CodeIgniter Forums

Full Version: not getting exact width and height in thumb image
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]ratna[/eluser]
i have following code. i have here width and height 50 each. but in thumb image i didn't get the same width and height. it is always lesser than the 50. i want thumb to have exact 50 width and height. please suggest.

$config['image_library'] = 'gd2';
$config2['source_image'] = './uploads1/plane.jpg';
$config2['create_thumb'] = TRUE;
$config2['maintain_ratio'] = TRUE;

$config2['width'] = 50;

$config2['height'] = 50;

$this->load->library('image_lib', $config2);

$this->image_lib->resize();

El Forum

[eluser]Cro_Crx[/eluser]
This line:

Code:
$config2['maintain_ratio'] = TRUE;

Keeps the image in the original aspect ratio. If you set it to false, your image will be resized to 50x50px. Although the original aspect ratio won't be the same.

El Forum

[eluser]ratna[/eluser]
it worked. thank you a lot.