Welcome Guest, Not a member yet? Register   Sign In
Two Image manipulation in the same controller call, resetting the $config
#1

[eluser]GabrieleMartino[/eluser]
Hello,

I have two operation, thumb and resize of an image from upload.

The fact is that is that i need to reset/overwrite the $config option of image_lib or the machine keep information.

Is there a way to reset or unload the library?

I write you the code
Code:
public function create_thumb($file_name,$chat_id){
             $config['image_library'] = 'gd2';
             $config['source_image'] = './uploads/'.$chat_id.'/'.$file_name;
             $config['create_thumb'] = TRUE;
             $config['maintain_ratio'] = TRUE;
             $config['width'] = 10;
             $config['height'] = 15;
             $config['new_image'] = './uploads/'.$chat_id.'/thumbs/'.$file_name;
             $this->load->library('image_lib');
             $this->image_lib->initialize($config);
             $this->image_lib->resize();
              
        }

Code:
public function resize_image($file_name,$chat_id){
            $config['image_library'] = 'gd2';
            $config['source_image'] = './uploads/'.$chat_id.'/'.$file_name;
            $config['width'] = 400;
            $config['height'] = 400;
            $config['master_dim'] = 'auto';
            $this->load->library('image_lib');
            $this->image_lib->initialize($config);
            $this->image_lib->resize();
            //echo $this->image_lib->display_errors();
        }

And here the call of the 2 methods above

Code:
$this->create_thumb($file['file_name'],$data['chat_id']);
          $this->resize_image($file['file_name'],$data['chat_id']);
#2

[eluser]Otemu[/eluser]
Code:
$this->image_lib->clear();
unset($config);




Theme © iAndrew 2016 - Forum software by © MyBB