Britman72/AT_presence

Font loading fails depending on environment

Closed this issue · 1 comments

It seems that GD doesn't always know how to resolve the font path. My friend set this up this evening, and hit a roadblock using XAMPP 3.2.2 and Windows 10.

The script fails with

imagettfbbox(): Could not find/open font in E:\xampp\htdocs\AT_presence\getpresence.php on line 86

I didn't have access to the environment, so don't have all the details, but modifying line 209 sorted us out: https://github.com/mrloofer/AT_presence/blob/master/getpresence.php#L209

Old:
$font = 'fonts/arial.ttf';
New:
$font = dirname(__FILE__) . '/fonts/arial.ttf';

I'd submit a PR for this, but I'm way out of touch with PHP, and 100% cargo culted my solution - I'll leave it up to you to decide if this is appropriate, or if there's a better way.

The presence server is awesome, thanks for sharing this! 👍

Good catch! Thanks for this. I tested your change and it works fine across all environments. Glad you like it.