I want to resize an image while uploading it, and save that resized image using CodeIgniter. I tried some code, but doesn't work. Also I want to know how to apply this in multiple files upload too.Can someone help
public function submited()
{
//$this->load->library('image_lib');
$config['upload_path'] = './images';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$this->load->library('upload',$config);
if($this->upload->do_upload('myfile'))
{
$filedata = $this->upload->data();
$this->load->library('image_lib');
$this->load->library('image_lib');
$config['allowed_types']='jpg|jpeg|png|gif';
$config['image_library'] = 'gd2';
$config['source_image'] = './images';
$config['new_image'] = './images';
$config['maintain_ratio'] = FALSE;
$config['width'] = 200;
$config['height'] = 150;
$config['quality'] = 75;
$this->image_lib->initialize($config);
$this->image_lib->resize();
$this->image_lib->clear();
}
}