Welcome Guest, Not a member yet? Register   Sign In
Create different size images in php code igniter
#1

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

thanks in advance
#2

[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 !!!
#3

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

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

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

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

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

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

[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;
#9

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

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




Theme © iAndrew 2016 - Forum software by © MyBB