Hello Amit cani upload resize image this
public function banner(){
if($this->session->userdata('logged_in')){
$session_data = $this->session->userdata('logged_in');
$data['username'] = $session_data['username'];
$this->load->view('administrator', $data);
}
else{
redirect('login','refresh');
}
$crud = new grocery_CRUD();
$crud->set_table('banner');
$crud->set_subject('Banner');
$crud->required_fields('bannerImage','bannerImage600','bannerImage370','bannerTitle','active');
$crud->columns('bannerTitle','bannerDescription','bannerImage','active');
$crud->display_as('sortOrder', 'Sort Order');
$crud->display_as('bannerTitle', 'Banner Title');
$crud->display_as('bannerDescription', 'Banner Description');
$crud->display_as('bannerImage', 'Banner Image Large');
$crud->display_as('bannerImage600', 'Banner Image Medium');
$crud->display_as('bannerImage370', 'Banner Image Small');
$crud->field_type('dateAdd', 'hidden');
$crud->field_type('dateEdit', 'hidden');
$crud->set_field_upload('bannerImage','../images/banner');
$crud->set_field_upload('bannerImage370','../images/banner');
$crud->set_field_upload('bannerImage600','../images/banner');
$crud->set_relation('active','aktivasi','active');
$crud->callback_after_upload(array($this,'example_callback_after_upload'));
$crud->callback_before_delete(array($this, 'delete_banner_image'));
$crud->unset_export();
$crud->unset_print();
$output = $crud->render();
$this->banner_crud($output);
}
public function banner_crud($output = NULL){
$this->load->view('banner.php',$output);
}
function example_callback_after_upload($uploader_response,$field_info, $files_to_upload)
{
$this->load->library('image_moo');
//Is only one file uploaded so it ok to use it with $uploader_response[0].
$bannerImage = $field_info->upload_path.'/'.$uploader_response[0]->name;
$bannerImage600 = $field_info->upload_path.'/'.$uploader_response[0]->name;
$bannerImage370 = $field_info->upload_path.'/'.$uploader_response[0]->name;
$this->image_moo->load($bannerImage)->set_jpeg_quality(90);
$this->image_moo->load($bannerImage600)->resize_crop(600,600)->save($bannerImage600,true);
$this->image_moo->load($bannerImage370)->resize_crop(370,370)->save($bannerImage370,true);
return true;
}
With my datebase
$bannerImage600 and $bannerImage370