I have two resize functions that I would like to perform one after the other using codeigniters image manipulation class:http://codeigniter.com/user_guide/libraries/image_lib.html
At the moment when I try running the function only the first one works, it ignores the second.
I have added $this->image_lib->clear() which according to codeigniters user guide: ‘resets all of the values used when processing an image. You will want to call this if you are processing images in a loop.’
Why can’t I run the two seperate resize functions? How would I go about doing this??
$image_data = $this->upload->data();
$config = array(
'source_image' => $image_data['full_path'],
'new_image' => $upload_path . '/thumbs/',
'maintain_ration' => true,
'width' => 150,
'height' => 100
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$this->image_lib->clear();
$config = array(
'source_image' => $image_data['full_path'],
'maintain_ration' => true,
'width' => 620,
'height' => 410
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
If you don’t want to use clear then store configs in two different arrays.
$this->image_lib->clear(); is used to flush previous settings & to add new.