1

I've been trying to use the following PHP code to generate a imagettfbbox:

$font_path = "/var/www/lib/fonts/Arial.ttf";

$rect = imagettfbbox(10,0,$font_path,"Hello world!");

However each time I try I get the following error:

Warning (2): imagettfbbox() [function.imagettfbbox]: Unable to find a CharMap that I can handle

I have both FreeType and GD support as confirmed with phpinfo(). I can't find any documentation indicating what might be causing this problem and this code works fine on an earlier version of PHP. Am I missing something else?

  • you sure that's the correct path for the font file, and it's readable by the process uid? – Marc B Feb 01 '16 at 17:05
  • @MarcB - To be sure I've changed the .ttf file permissions to 777 and double checked the file path, it's correct. – user2890042 Feb 01 '16 at 17:11
  • 2
    I've found the issue - for some reason the file was being corrupted when uploading to my server. I replaced the TTF file with another version and it worked fine! Thanks for your suggestions anyway @MarcB – user2890042 Feb 01 '16 at 17:27

0 Answers0