[eluser]bugboy[/eluser]
Hello all
I have a quick question.
I have this code which i use a lot to help me create the image size's i need.
I use this a lot as it allows me to have a loop and to create images sizes when uploading multiple images.
At the minute i have placed it in a model and it works just fine and keeps my code smaller and neater. But i'm wondering is this the best way or am i right in thinking i could extend the image_lib libray to do this?
I just want to get my coding practice up to scratch.
Code:
function resizeImage($filename, $folder, $width, $height, $thumb=FALSE){
$config['source_image'] = $folder.$filename;
$config['maintain_ratio'] = TRUE;
$config['width'] = $width;
$config['height'] = $height;
$config['master_dim'] = 'width';
// create a thumb
if($thumb == TRUE){
$config['new_image'] = $folder.'thumb_'.$filename;
}
$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize())
{
return $this->image_lib->display_errors();
}
}
Any advice would be most appreciated.