开发者

"Could not find/open font" when using PHP gd

开发者 https://www.devze.com 2023-01-17 16:47 出处:网络
I am getting this error Could not find/open fo开发者_开发技巧nt When trying imagettftext() in PHP.

I am getting this error Could not find/open fo开发者_开发技巧nt When trying imagettftext() in PHP.

The font file is there. What is the problem?


I found the answer on bytes http://bytes.com/topic/php/answers/4833-gd-could-not-find-open-font-font-problem

Setting the gdfontpath may help

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

精彩评论

暂无评论...
验证码 换一张
取 消