• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image_lib watermark saves a blank image

#1
[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.


Messages In This Thread
Image_lib watermark saves a blank image - by El Forum - 07-11-2012, 08:10 AM
Image_lib watermark saves a blank image - by El Forum - 07-11-2012, 12:36 PM
Image_lib watermark saves a blank image - by El Forum - 07-11-2012, 12:44 PM
Image_lib watermark saves a blank image - by El Forum - 07-11-2012, 01:17 PM
Image_lib watermark saves a blank image - by El Forum - 07-13-2012, 03:50 AM
Image_lib watermark saves a blank image - by El Forum - 07-13-2012, 05:20 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.