【问题标题】:"Could not find/open font" when using PHP gd使用 PHP gd 时“找不到/打开字体”
【发布时间】:2010-09-28 05:22:33
【问题描述】:

在 PHP 中尝试 imagettftext() 时出现此错误 Could not find/open font

字体文件在那里。有什么问题?

【问题讨论】:

    标签: php fonts gd


    【解决方案1】:

    我在字节 http://bytes.com/topic/php/answers/4833-gd-could-not-find-open-font-font-problem 上找到了答案

    设置 gdfontpath 可能会有所帮助

    $fontpath = realpath('.'); //replace . with a different directory if needed
    putenv('GDFONTPATH='.$fontpath);
    $font = 't.otf';
    ...
    $box = imagettfbbox($size, 0, $font, $text);
    

    【讨论】:

    • 与这个问题斗争太久了。天哪,谢谢你。
    猜你喜欢
    • 2018-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-09
    • 1970-01-01
    • 1970-01-01
    • 2020-09-10
    • 1970-01-01
    相关资源
    最近更新 更多