[eluser]barbazul[/eluser]
Guys, similar problem here:
I have a model method that recieves a path to an image file and makes 5 copies of it with different dimensions (original, 50x50 thumbnail, 480x360, 200x150 and 100x75)
Basically I copy() the first one, resize as thumbnail then crop for the second one, then resize and crop for the third and finally resize the third one and set a new filename to create number 4 and 5.
The controller method is very simple:
Code:
foreach($paths as $path) {
$this->photo->create($path);
}
Each of the model methods that actually manipulate the files look similar to this (no point in copying it excactly):
Code:
private function _copyMain($path)
{
$image_lib_config['image_library'] = 'gd2';
$image_lib_config['source_image'] = $path;
$image_lib_config['create_thumb'] = FALSE;
$image_lib_config['maintain_ratio'] = TRUE;
$image_lib_config['new_image'] = 'somename.jpg'; // I generate unique filenames foreach with another method
$image_lib_config['quality'] = 85;
$image_lib_config['width'] = 200;
$image_lib_config['height'] = 150;
$this->image_lib->initialize($image_lib_config);
$this->image_lib->resize();
$this->image_lib->clear();
}
Options change from method to method.
For instance, different with/height
I only set the 'create_thumb' option to TRUE for the 50x50 thumbnail
So, the tricky part is that the FIRST one works perfectly, but each image thereafter fails to create a thumbnail but instead resizes the original to 50x50 which obviously breaks each new copy after that (they enlarge the 50x50 thumb instead of shrinking the original picture)
Any ideas?