[eluser]ELRafael[/eluser]
Greetings... i have this situation:
An user'll post an image, and the app needs to resize to the layout width/height...
so is my code:
Code:
//Redimensiona a foto
$config1['image_library'] = 'GD2';
$config1['source_image'] = "./public/$photo";
$config1['create_thumb'] = TRUE;
$config1['maintain_ratio'] = TRUE;
$config1['width'] = 80;
$config1['height'] = 80;
$this->load->library('image_lib', $config1);
//Cria o thumb
$this->image_lib->resize();
Ok, this works fine :-P
Original file: 1.jpg
Thumb: 1_thumb.jpg
But, if the user puts an image larger, i want to resize the ORIGINAL.
So what i do
Code:
//Redimensiona a original
$config1['create_thumb'] = FALSE;
$config1['width'] = 480;
$config1['height'] = 300;
$this->load->library('image_lib', $config1);
$this->image_lib->resize();
But the orginal image still the same dimensions! >:-(
I didn't put all the values from $config1 in the second resize method call cause i think that gets the last values.
this is the hole code
Code:
//Redimensiona a foto
$config1['image_library'] = 'GD2';
$config1['source_image'] = "./public/$photo";
$config1['create_thumb'] = TRUE;
$config1['maintain_ratio'] = TRUE;
$config1['width'] = 80;
$config1['height'] = 80;
$this->load->library('image_lib', $config1);
//Cria o thumb
$this->image_lib->resize();
//Redimensiona a original
$config1['create_thumb'] = FALSE;
$config1['width'] = 480;
$config1['height'] = 300;
$this->load->library('image_lib', $config1);
$this->image_lib->resize();