duanchuang1935 2019-02-13 07:33
浏览 238

Captcha Helper Codeigniter错误 - imagettftext():找不到/打开字体

please help me solve this problem. I want to use the captcha in my login page using captcha helper in CodeIgniter, but got some error like this :

A PHP Error was encountered

Severity: Warning

Message: imagettftext(): Could not find/open font

Filename: helpers/captcha_helper.php

=============================================

this is my controller :

public function login() {

    $data['captcha'] = $this->set_captcha();
    $this->load->view('access/login', $data);

}

public function set_captcha() {

    $vals = array(
        'img_path'      => './assets/img/captcha/',
        'img_url'       => base_url('assets/img/captcha'),
        'font_path'     => './assets/fonts/Kalam-Regular.ttf',
        'img_width'     => 175,
        'img_height'    => 55,
        'expiration'    => 3600,
        'word_length'   => 5,
        'font_size'     => 17,
        'pool'          => '0123456789abcdefghijklmnopqrstuvwxyz',

        // White background and border, black text and red grid
        'colors'        => array(
            'background' => array(255, 255, 255),
            'border' => array(255, 255, 255),
            'text' => array(160, 160, 160),
            'grid' => array(255, 183, 206)
        )
    );

    $cap = create_captcha($vals);

    return $cap['image'];

}

and then I just echo the captcha variable in the view.

the problem is only show in windows (XAMPP) but not in my ubuntu server. please tell me if any duplicate of this post, I have searched the list of posts & google but did not find the same problem.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器