[eluser]Unknown[/eluser]
Hello friends,
I've been trying to make a helper that processes an image filename passed as an argument, and returns a relative path to the newly-created (and resized) image. The helper doesn't error, and returns the correct value, but the actual resized image never gets created. Is there something glaringly wrong about this code?
Thank you for your input.
Code:
function resized_image($graphic_filename, $type)
{
$CI =& get_instance();
$CI->load->library('image_lib');
$image_path = "/home/lfc1450/webapps/lfcfrontend/images/message_images/";
$cached_path = "/home/lfc1450/webapps/lfcfrontend/images/cached/";
$url_path = "/images/cached/";
$config['image_library'] = 'imagemagick';
$config['library_path'] = '~/bin';
$config['maintain_ratio'] = TRUE;
$config['quality'] = '90%';
if ($type == "billboard")
{
$config['source_image'] = $image_path.$graphic_filename;
$config['new_image'] = $cached_path.'billboard/'.$graphic_filename;
$config['width'] = 940;
$CI->image_lib->initialize($config);
if ( ! $CI->image_lib->resize())
{
echo $CI->image_lib->display_errors();
}
return $url_path.'billboard/'.$graphic_filename;
}
}