Error using imagettftext() in php 7.2 cannot find truetype font


#1

imagettftext($image, 10, 90, $i, 46, $grey, “Arial.ttf”, $text);

Hi baffled by this error I keep getting when my app is compiled using php 7.2 (works fine using php 5.6) on the above image calls…

imagettftext(): Could not find/open font in C:\Users\Orion\Exeoutput2018\cast-desk-optimiser\Data\desks-edit.php

the font Arial.ttf exists and is in the same path as the .php file…

Any help would be gratefully received. Thanks. Using version 2018.3.


#2

as a temporary solution resorted to using imagestring($image, 1, $i, 46, $text, $grey); - but would be nice to get truetype fonts working again… I tried playing around with the paths… tried "./Arial.ttf’ and even “…/Arial.ttf” but nothing made any difference, the file definately existed.


#3

Have you tried DOCUMENT_ROOT? To specify a full path instead of a relative path to “Arial.ttf”?


#4

Will try thanks