Can I programmatically determine which fonts I can use with GD?

I want to put text on top of an image using GD.

When i use

ImageTTFText($image, $fontSize, $fontRotation, 7, 22, $colorShadow, 'arial.ttf', $str);

I get

Warning: imagettftext () [function.imagettftext]: could not find / open the font in /home/index.php on line 17

Can I force PHP or GD to return a list of all available fonts on my system?

thank

Update

... or do I need to download all the fonts myself so that I want GD to have access?

+3
source share
3 answers

Replace "arial.ttf"with "./arial.ttf", because "arial.ttf"- this is an absolute path, and you need a relative path. Read more about imagettftext here .

, , . (, arial.ttf): http://www.1001freefonts.com/

, script, "arial.ttf" "./filename.ttf".

+1

Imagemagick,

0

Fonts can be anywhere, but you must specify the full path to arial.ttf.

0
source

Source: https://habr.com/ru/post/1758310/


All Articles