thumbnail codeigniter

1

I've mounted this class that does a multiupload of images, creates the folders according to id_an, and then generates the thumbs of these images as% wheel. The problem is that thumbs are not being generated.

My thumb class:

function _createThumbnail($filename,$path)
{        

    $config['image_library']    = "gd2";      

    $config['source_image']     = "{$path}/{$filename}";                

    $config['create_thumb']     = TRUE;      

    $config['maintain_ratio']   = TRUE;      

    $config['width'] = "80";      

    $config['height'] = "80";

    $this->load->library('image_lib',$config);
    //die(print_r($this->image_lib->resize()));
    if(!$this->image_lib->resize())

    {

        die(print_r($this->image_lib->display_errors()));

    }      
}
    
asked by anonymous 18.09.2015 / 06:36

1 answer

0

Good afternoon. I would use it like this:

function _createThumbnail($filename,$path)
{        
    $this->load->library('image_lib');
    $config['image_library']    = "gd2";      

    $config['source_image']     = "{$path}/{$filename}";                

    $config['create_thumb']     = TRUE;      

    $config['maintain_ratio']   = TRUE;      

    $config['width'] = "80";      

    $config['height'] = "80";

    $this->image_lib->clear();
    $this->image_lib->initialize($config);

    //die(print_r($this->image_lib->resize()));
    if(!$this->image_lib->resize())

    {

        die(print_r($this->image_lib->display_errors()));

    }      
}

I've had problems on servers where I must first clear the lib configuration and then configure it again.

I hope I have helped.

Oss

    
27.06.2016 / 19:21