Welcome Guest, Not a member yet? Register   Sign In
create more than 2 thumbnails using ci
#1

[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;
    }
}


Messages In This Thread
create more than 2 thumbnails using ci - by El Forum - 04-28-2010, 01:52 AM
create more than 2 thumbnails using ci - by El Forum - 04-28-2010, 01:56 AM
create more than 2 thumbnails using ci - by El Forum - 04-28-2010, 03:11 AM
create more than 2 thumbnails using ci - by El Forum - 04-28-2010, 03:21 AM
create more than 2 thumbnails using ci - by El Forum - 05-03-2010, 01:29 AM
create more than 2 thumbnails using ci - by El Forum - 05-06-2010, 03:08 AM
create more than 2 thumbnails using ci - by El Forum - 12-27-2010, 10:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB