[eluser]Mr. Pickle[/eluser]
I'm having problems using the image_lib in a loop.
Description:
I have a folder with several image files.
I loop all the image files within a folder to copy them (with new dimensions) to a different directory.
Therefor I use the image_lib with which you have to set the settings (such as source file, dimensions and destination file) in a config array and pass them to the image lib.
This is my code for that part:
Code:
$config['image_library']= 'gd2';
$config['source_image'] = $dir . $file;
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 1024;
$config['height'] = 768;
$config['new_image'] = $this->config->item('photo_dir') . strtolower($file);
$this->load->library('image_lib', $config);
Next thing is that I do the resize action:
Code:
$this->image_lib->resize();
After this I clear the image_lib:
Code:
$this->image_lib->clear();
My problem
The image lib is still using the config from the first loop as I only get the first image (name) with the last image content in my destination folder.