0

I have created a library file that manages gallery functions, when a user uploads an image.

This code will not create a thumbnail - it tries to resize the original image - am i missing something obvious?

private function _create_thumbnail($file_path)
{
    $config['image_library']  = 'gd2';
    $config['source_image']   = $file_path;
    $config['create_thumb']   = 1;
    $config['maintain_ratio'] = 1;
    $config['width']          = 90;
    $config['height']         = 90;

    $this->CI->load->library('image_lib', $config); 
    $this->CI->image_lib->initialize($config);

    $result = $this->CI->image_lib->resize();
    print_r( $this->CI->image_lib->display_errors());
    print_r($config);

    // if(!$result) {
    //  // echo $this->CI->image_lib->display_errors(); 
    //  print_r($this->CI->image_lib->display_errors()); 
    // } 

    return $result;
}
jleft
  • 3,457
  • 1
  • 23
  • 35
Chris Mccabe
  • 1,902
  • 6
  • 30
  • 61

1 Answers1

0

Remove the below line and try again

$this->CI->image_lib->initialize($config);
Sudz
  • 4,268
  • 2
  • 17
  • 26