CodeIgniter Forums
not getting exact width and height in thumb image - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: not getting exact width and height in thumb image (/thread-24795.html)



not getting exact width and height in thumb image - El Forum - 11-19-2009

[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();


not getting exact width and height in thumb image - El Forum - 11-20-2009

[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.


not getting exact width and height in thumb image - El Forum - 11-20-2009

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