0

I upload images with a php script and I want to be able to change the size of an image if the image is too big and then create a thumb of the same image, right now I the image is resized but the thumb is not created for some reason...no errors either. here is the script:

        if($image_data['image_width'] > 1024 || $image_data['image_height'] > 768)
      {


    $config_resize = array(
            'source_image' => $image_data['full_path'],
            'new_image' => "./uploads/",
            'overwrite' => true,
            'maintain_ratio' => true,
            'width' => 1024,
            'height' => 768
            );
     $this->load->library('image_lib', $config_resize);
     if(! $this->image_lib->resize())
       {
         echo $this->image_lib->display_errors();
       }


    $config_thumb = array(
        'source_image' => $config_resize['source_image'],
        'new_image' => "./uploads/thumbs/",
        'maintain_ratio' => true,
        'width' => 150,
        'height' => 100
        );
    $this->load->library('image_lib', $config_thumb);

    if(! $this->image_lib->resize())
       {
         echo $this->image_lib->display_errors();
       }


      }
rabidmachine9
  • 7,775
  • 11
  • 46
  • 59

1 Answers1

2
.....
.....  

    $config_thumb = array(
                'source_image' => $config_resize['source_image'],
                'new_image' => "./uploads/thumbs/",
                'maintain_ratio' => true,
                'width' => 150,
                'height' => 100
                );

$this->image_lib->initialize($config_thumb); // <--- !!!

and don't load a library twice

Ivan
  • 491
  • 6
  • 15