[eluser]dsi[/eluser]
hi, i am trying to create 1 main uploaded file and 2 other different size thumbnails. i have successfully created the first thumbnail but couldnot create 2nd thumbnail, can anyone help.
i have created a function for main upload file, it will call 2nd function for 1st thumbnail creation. I tried to call 3rd function for 2nd thumbnail generation but it doesnot work. I tried calling from both functions.
any suggestions?
here is my file upload class
Code:
class Upload_model extends Model{
function do_upload(){
$this->load->library('upload');
if ($this->upload->do_upload()){
$file_info=$this->upload->data();
$q=$this->_create_thumbnail($file_info['file_name']);
$r=$this->_create_thumbnail1($file_info['file_name']);
if($r){
$file['file_name']=$file_info['raw_name'];
$file['file_ext']=$file_info['file_ext'];
return $file;
}
}
}
function _create_thumbnail($filename){
$config['image_library'] = 'gd2';
$config['source_image'] = 'upload/'.$filename;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['new_image']='upload/thumb/';
$config['width'] = 154;
$config['height'] = 121;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
}
function _create_thumbnail1($filename){
$config['image_library'] = 'gd2';
$config['source_image'] = 'upload/'.$filename;
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['new_image']='upload/thumb/featured/';
$config['width'] = 154;
$config['height'] = 121;
$this->load->library('image_lib', $config);
if($this->image_lib->resize()) return true;
}
}