Welcome Guest, Not a member yet? Register   Sign In
Watermark font problem in codeigniter
#1

[eluser]zombica[/eluser]
Hey Guys i am displaying the water mark image containing some text over it but it doesn't display any thing.

Here is my code
Code:
$config['image_library'] = 'GD2';
            $config['source_image'] = 'images/watermark.png';
            $config['wm_text'] = 'Negotiable';
            $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);

If i display with this font it throws me following error:

A PHP Error was encountered
Severity: Warning
Message: imagettftext() [function.imagettftext]: Could not read font
Filename: libraries/Image_lib.php
Line Number: 1094

i have updated the font folder and applied some more fonts but in that case it displays nothing.

Whats the real issue behind this. i have found no solution regarding this on internet.

Regards,
Zombica.
#2

[eluser]Haloperidol[/eluser]
This is a GD error message. The GD couldnt handle the texb.ttf on my system either btw, but worked fine with others. GD throws similar errors when the font has special chars in its name, try to rename a font to like 'aaa.ttf' and see if it helps.
Also i dont know if this is just a snippet from your code, but theres a few more lines to watermark an image:
Code:
...
    $this->image_lib->initialize($config);
    if ( !$this->image_lib->watermark())
    {
        echo $this->image_lib->display_errors();
    }
    and then you display the watermarked image...




Theme © iAndrew 2016 - Forum software by © MyBB