CodeIgniter Forums
captcha open font error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: captcha open font error (/showthread.php?tid=76239)



captcha open font error - hafijul233 - 04-24-2020

there is a problem when add font_path value.
With out "font_path" Everything went fine i need to increase font size and add bold character.
So I had Arial Bold Font.
working config
PHP Code:
$vals = [
            'img_path' => './captcha/',
            'img_url' => base_url('captcha/'),
            'img_width' => 260,
            'img_height' => 45,
            'expiration' => 900,
            'word_length' => 6,
            'font_size' => 20,
            'img_id' => 'Imageid',
            'pool' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',

            // White background and border, black text and red grid
            'colors' => array(
                'background' => array(255255255),
                'border' => array(255255255),
                'text' => array(000),
                'grid' => array(2554040)
            )
        ]; 
Are Fine
when I Had
PHP Code:
$vals = [
            'img_path' => './captcha/',
            'img_url' => base_url('captcha/'),
            'font_path' => './dist/fonts/arialbd.ttf'// font line from server
            'img_width' => 260,
            'img_height' => 45,
            'expiration' => 900,
            'word_length' => 6,
            'font_size' => 20,
            'img_id' => 'Imageid',
            'pool' => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',

            // White background and border, black text and red grid
            'colors' => array(
                'background' => array(255255255),
                'border' => array(255255255),
                'text' => array(000),
                'grid' => array(2554040)
            )
        ]; 
I got a error  that :
Severity: Warning
Message: imagettftext(): Could not find/open font
Filename: helpers/captcha_helper.php
Line Number: 272


RE: captcha open font error - php_rocs - 04-24-2020

@hafijul233,

Are the permissions set correctly for the file to be opened?


RE: captcha open font error - hafijul233 - 04-24-2020

(04-24-2020, 10:11 AM)php_rocs Wrote: @hafijul233,

Are the permissions set correctly for the file to be opened?
Yes. when I add base_url() No Error.


RE: captcha open font error - php_rocs - 04-24-2020

@hafijul233,

When the code is executed what does the system think that the path is?