CodeIgniter Forums
Create different size images in php code igniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Create different size images in php code igniter (/showthread.php?tid=4968)



Create different size images in php code igniter - El Forum - 12-27-2007

[eluser]Sawariya[/eluser]
how can create an image in different size
anybody can help me..

thanks in advance


Create different size images in php code igniter - El Forum - 12-28-2007

[eluser]Sarfaraz Momin[/eluser]
Hi, You can use the image library to manipulate the images. Some examples extracted from the user guide are given below.

<<< create thumb >>>
Code:
$img_cfg_thumb['source_image'] = '/image/abc.jpg';
$img_cfg_thumb['create_thumb'] = TRUE;
$img_cfg_thumb['thumb_marker'] = '_thumb';
$img_cfg_thumb['maintain_ratio'] = TRUE;
$img_cfg_thumb['width'] = 300;
$img_cfg_thumb['height'] = 200;
$this->load->library('image_lib');
$this->image_lib->initialize($img_cfg_thumb);
$this->image_lib->resize();

<<< Resize >>>
Code:
$img_cfg_thumb['source_image'] = '/image/abc.jpg';
$img_cfg_thumb['maintain_ratio'] = TRUE;
$img_cfg_thumb['width'] = 300;
$img_cfg_thumb['height'] = 200;
$this->load->library('image_lib');
$this->image_lib->initialize($img_cfg_thumb);
$this->image_lib->resize();

Good Day !!!


Create different size images in php code igniter - El Forum - 12-28-2007

[eluser]metaltapimenye[/eluser]
sweet concept..

both of them have a same size?
Code:
$img_cfg_thumb['width'] = 300;
$img_cfg_thumb['height'] = 200;



Create different size images in php code igniter - El Forum - 12-28-2007

[eluser]Sawariya[/eluser]
Thank you
hai dear friend this code i already tried.. this will be created same size of images....

i want different size of images..


Create different size images in php code igniter - El Forum - 12-29-2007

[eluser]Chris Newton[/eluser]
So... set the width & height to different numbers. Am I missing something?


Create different size images in php code igniter - El Forum - 01-02-2008

[eluser]Sawariya[/eluser]
where i want set the width & height to different numbers?
can you specify..?


Create different size images in php code igniter - El Forum - 01-02-2008

[eluser]gunter[/eluser]
Sawariya, just look to the code...
the answer is so simple - it´s a shame... :red:


Create different size images in php code igniter - El Forum - 01-02-2008

[eluser]oracledarren[/eluser]
I would use a variable eg.

Code:
$mywidth = 100;
$myheight = 200;

You can alter the values according to your requirement.

Code:
$img_cfg_thumb['width'] = $mywidth;
$img_cfg_thumb['height'] = $myheight;



Create different size images in php code igniter - El Forum - 01-02-2008

[eluser]Sawariya[/eluser]
thanks for your reply


Create different size images in php code igniter - El Forum - 12-18-2008

[eluser]Unknown[/eluser]
Thank you, Sarfaraz Momin for example! BTW, example in User Guide is not working: Image Manipulation Class.