【发布时间】:2019-08-27 15:22:29
【问题描述】:
我的函数返回错误信息:
Call to undefined function imagettftext()
我已经尝试了所有方法,但无法启用(--with-freetype-dir=DIR)
$black = imagecolorallocate($text_im, 0, 0, 0);
imagefilledrectangle($text_im, 0, 0, 399, 29, $white);
$text = 'testing shop ,9876543214';
// Replace path by your own font path
$font = 'arial.ttf';
imagettftext($text_im, 20, 0, 10, 20, $black, $font, $text);
imagepng($text_im);```
【问题讨论】:
-
是否启用了
gd扩展?这可以通过搜索调用phpinfo()并检查页面是否包含GD来检查 -
是的,它已启用
-
您是否指向您计算机上的 freetype-dir? ` --with-freetype-dir=/usr/local/lib/freetype-2.1.9/`
-
不知道如何在 mac 中做到这一点
-
我添加了一个指南作为答案
标签: php php-7 imagettftext