[eluser]thisischris[/eluser]
Hello everyone. I'm trying to add a watermark to an image but it's just saving the original image.
Here is my code (it's in a helper).
Code:
function generate_text_thumbnail($text)
{
$CI =& get_instance();
$font = 'Sanchezregular.otf';
$config['image_library'] = 'gd2';
$config['source_image'] = './public/images/blank_thumb.png';
$config['new_image'] = './public/text_entries/test.png';
$config['dynamic_output'] = FALSE;
$config['create_thumb'] = FALSE;
$config['wm_text'] = $text;
$config['wm_type'] = 'text';
$config['wm_font_path'] = './system/fonts/' . $font;
$config['wm_font_size'] = '16';
$config['wm_font_color'] = '993300';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
$config['wm_padding'] = '20';
$CI->load->library('image_lib', $config);
return $CI->image_lib->watermark();
}
The function returns true, but the image (/public/text_entries/test.png) is exactly the same like the original. I'm struggling to see where I've gone wrong. Any input would greatly be appreciated.
I've made sure that it's not loading the library twice by removing $CI->load->library('image_lib', $config); which then gave me a PHP error saying 'Call to a member function watermark() on a non-object'
Thank you.