Hello web developers :) I looked around the forums, but I couldn't find an answer to my problem.
The function itself is working, no problems uploading image or resizing it if it's one image and one action at a time.
I'm using this example below:
function image_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]. $file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name; $thumbnail = $field_info->upload_path.'/thumbnail/'.$uploader_response[0]->name; $this->image_moo->load($file_uploaded)->save($file_uploaded,true); $this->image_moo->load($thumbnail)->resize(220,80)->save($thumbnail,true); return true; }
and I have these setups in my main crud function:
$this->config->set_item('grocery_crud_file_upload_allow_file_types', 'gif|jpeg|jpg|png'); $crud->set_field_upload('file_url','assets/uploads/files'); $crud->callback_after_upload(array($this,'image_callback_after_upload'));
what I want to do is to create a thumbnail which will be stored to assets/uploads/files/thumbnail/image_name
and original size picture to be stored in assets/uploads/files/image_name , however for some reason my thumbnail is not created. I also have set permission to my thumbnail, files and uploads folders to 777. note I did not set any permission for asset folder but I think it's on 777 permission as well.
when I remove one action, for example
$file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name; $this->image_moo->load($file_uploaded)->save($file_uploaded,true);
than a thumbnail is created but for some reason it is ignoring the path root which would be assets/uploads/files/thumbnail/image_name my thumbnail is stored than in the main upload folder
assets/uploads/files/image_name
Could someone tell me first of all
why is this path being ignored
$thumbnail = $field_info->upload_path.'/thumbnail/'.$uploader_response[0]->name;