CodeIgniter Forums
Watermark Problem (possibly font issue?) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Watermark Problem (possibly font issue?) (/showthread.php?tid=4937)



Watermark Problem (possibly font issue?) - El Forum - 12-25-2007

[eluser]omed habib[/eluser]
I'm trying to use the image class to watermark an image. I have the GD library installed on the system (version 2.0.28) and am using the following code:

Code:
$this->load->library('image_lib');

    $config['image_library'] = 'GD2';
    $config['source_image'] = SITE_ROOT.INVENTORYIMAGES.$pk_inventory_id.'/'.$filename;
    $config['wm_text'] = 'Copyright 2006 - John Doe';
    $config['wm_type'] = 'text';
    $config['wm_font_path'] = './system/fonts/texb.ttf';
    $config['wm_font_size'] = '35';
    $config['wm_font_color'] = '000000';
    $config['wm_vrt_alignment'] = 'bottom';
    $config['wm_hor_alignment'] = 'center';
    $config['wm_padding'] = '20';
    
    $this->image_lib->initialize($config);    
    
    $this->image_lib->watermark();

The above code produces the following error message:

Quote:A PHP Error was encountered

Severity: Warning

Message: imagettftext() [function.imagettftext]: Could not read font

Filename: libraries/Image_lib.php

Line Number: 1077

If I comment out the wm_font_path, the error disappears, but it still doesn't work. I also tried to echo $this->image_lib->display_errors();, but to not avail :\

Any ideas anyone?


Watermark Problem (possibly font issue?) - El Forum - 12-25-2007

[eluser]kenjis[/eluser]
The same error occured in my XAMPP environment.

I don't know why, but the font texb.ttf is the problem.


Watermark Problem (possibly font issue?) - El Forum - 01-14-2009

[eluser]Vijusoft[/eluser]
Yes you are right the font (texb.ttf) gives error.I uploaded new fonts in the fonts folder & it works...
:-)


Watermark Problem (possibly font issue?) - El Forum - 03-28-2013

[eluser]rip_pit[/eluser]
i tried with a windows default bold arial file "./system/fonts/arialbd.ttf" (file is copied in the folder) but it seems to fail the same. what font did you use for replacement ?