The problem is: Yes it resizes me a pic into a thumb, but I also need other pics to another size. Thus I sorted of cloned the first function for the thumb for the other pics, just changing the name of the variables in the hope of avoiding overwriting them. However, if I add other fuctions, callback functions, it will not resize.
I had the
$crud->set_field_upload('thumb_a','assets/uploads/files');
$crud->callback_after_upload(array($this,'example_callback_after_upload'));
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].
$file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;
$this->image_moo->load($file_uploaded)->resize(100,100)->save($file_uploaded,true);
return true;
}
function call working fine and resizing me a pic into a thumb.
However, I also needed the resizing of other pics to other sizes. So I tried to create other function calls with different names and parameters like this:
$crud->set_field_upload('pic1','assets/uploads/files');
$crud->callback_after_upload(array($this,'pic_callback_after_upload'));
function pic_callback_after_upload($uploader_response,$field_info, $files_to_upload1)
{
$this->load->library('image_moo');
//Is only one file uploaded so it ok to use it with $uploader_response[0].
$file_uploaded1 = $field_info->upload_path.'/'.$uploader_response[0]->name;
$this->image_moo->load($file_uploaded1)->resize(630,400)->save($file_uploaded1,true);
return true;
}
But no. If I add that new function, the thumb resizing function will stop working and will not resize me, it will just upload the picture the size it was.
I can see why this is happening because since there is another callback function when something has been uploaded, then it is overwritten and the thumb_a finds itself in a mess, thus it does nothing. If I highlight the second function and drag it above the thumb_a, then thumb does not get overwritten, but it would be the pic1 which would be overwritten. I can see it clearly but I don't see any solution to this, and however it must be possible to resize first for the thumb picture and then another size for the rest of the pics.
Have I asked the most intelligent question about which nobody had thought?
A