Workaround for UTF-8 issues with PHP's imagestring

Some of you may have expirienced the issue, that php's

imagestring-function doesn't properly show UTF-8 characters.

As workaround you can use the imagettftext-function.

When using imageTTFtext instead of imagestring, you have to know, that you don't use the $font-ids from PHP, instead you use fontfiles.


imagestring ( resource $im, int $font, int $x, int $y, string $s, int $color )

becomes to:

imagettftext ( resource $im, int $size, int $angle, int $x, int $y, int $color, string $fontfile, string $text ) 

Keep $angle=0 if you want just horizontal-text. Hope that helps!

In open source, php, utf-8 by
@ 04 Nov 2007, Comments at Reddit & Hackernews