简体   繁体   中英

Gd and Freetype enable but still get this error Call to undefined function imagettftext()

在此处输入图片说明

here is my code

$r = hexdec(substr($text->color, 2, 2));
$g = hexdec(substr($text->color, 4, 2));
$b = hexdec(substr($text->color, 6, 2));
$color = imagecolorallocate($image, $r, $g, $b);
$font = resource_path().'/font/arial.ttf';
imagettftext($image, 5, 0, 0, 0, $color, $font, "text");

I have download that font file from some webboard and move to my resource folder and i have check the arial.ttf is exist , but still got this error

Call to undefined function imagettftext()

Thanks.

As you can see in PHP documentation , there is a note, that this function is only available if PHP was complied with FreeType support.

 --with-freetype-dir=DIR

Step by step instructions, how to do that could be found at ServerFault and the first step is to install FreeType library .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM