[eluser]tonanbarbarian[/eluser]
Where does your function exist?
Is it in a helper, controller or library?
Not sure if any of these will help but they might...
1. No matter where this is being running from I am assuming the $base is an instance of the CI controller.
The first issue is that you are not passing that into the function by reference so it might be having problems due to that.
The main issue is that it might not load the image library properly, although I would expect that to produce an error.
2. Other issue is that I have found an occasion where there was problems with image generation because even though the width and height values were numbers they were of the string type rather than an integer
If you are running the code from a CI controller then just reference the $base as $this. If you are running from a library or helpder then I recommend making an instance of the CI as in the example provided below
Code:
function generateThumbnail($source, $output, $width, $height, $watermark = true) {
$CI =& get_instance();
$dir = dirname($output);
if(!is_dir($dir))
recursive_mkdir($dir);
$config['image_library'] = 'GD';
$config['source_image'] = $source;
$config['create_thumb'] = true;
$config['new_image'] = $output;
$config['maintain_ratio'] = TRUE;
$config['width'] = (int)$width;
$config['height'] = (int)$height;
$CI->load->library('image_lib', $config);
if(!$CI->image_lib->resize())
echo 'Unable to create thumbnail';
if($watermark)
applyWatermarkToImage($base, $output);
}