[eluser]HovaCarlito[/eluser]
Thanks for the reply.
I was hoping to avoid not using CI's tools. Plus, of course, from a developer point of few I'd like to know what I do wrong
EDIT:
OK, the problem seemed to be that I expected CI to clear all it's loaded configuration on clear(). Apparently it doesn't. I had to turn the thumb function off in the second pass.
Final, working code:
Code:
/* handleResize handles the resizing of the photos.
returns true on success, false on error */
function handleResize($path){
/* Configuration for the thumbnail */
$config['image_library'] = 'gd2';
$config['source_image'] = $path;
$config['maintain_ratio'] = TRUE;
$config['width'] = 375;
$config['height'] = 500;
$config['create_thumb'] = TRUE;
/* Initialize the configuration */
$this->image_lib->initialize($config);
/* Handle the resizing, if something went wrong, print the error and return false */
if ( ! $this->image_lib->resize()){
echo $this->image_lib->display_errors();
return false;
}
/* Well, it does... something */
$this->image_lib->clear();
/* Settings for the big file */
$config_big['image_library'] = 'gd2';
$config_big['source_image'] = $path;
$config_big['maintain_ratio'] = TRUE;
$config_big['width'] = 510;
$config_big['height'] = 680;
$config_big['create_thumb'] = FALSE;
/* Init the config */
$this->image_lib->initialize($config_big);
/* Resize it */
if ( ! $this->image_lib->resize()){
echo $this->image_lib->display_errors();
return false;
}
/* Yay! It worked! Return true and dance */
return true;
}