Warning: imagettftext(): Invalid font filename in PHP ?

923 views
Skip to first unread message

Alex Kerr

unread,
Oct 10, 2015, 11:29:53 AM10/10/15
to Google App Engine
Hi,

I'm trying to use a font with PHP's imagettftext() and no matter what I do I get the "Warning: imagettftext(): Invalid font filename" error. The font file is at an external public URL - specifying this directly causes the error. So I then used file_get_contents() and file_put_contents() to put a copy of the file on Cloud Storage (which copied fine) and access with the standard 'gs://' file path in my imagettftext() call. This also causes the error. I've reviewed the PHP docs and tried every combination of filepath I can think of including putenv('GDFILEPATH='.[my gs:// path]) or putting a / or // in front of my gs:// filepath. Nothing works. putenv and getenv don't seem to work at all anyway!

I also tried using the temp in memory drive on GAE ('vfs://') with same error. (And using 'vfs://' gives an error that it's read only which should not be the case!?)

Looks like imagettftext() can only be used with read only fonts deployed statically with the app (which I can't do for various reasons - I have to access them dynamically).

Anyone got any ideas!?

Many thanks,
Alex

Nick (Cloud Platform Support)

unread,
Oct 12, 2015, 6:50:22 PM10/12/15
to Google App Engine
This post represents a specific technical issue and would be better posted to the public issue tracker. Feel free to do that, and your report will be triaged shortly. This forum is intended for more general discussion of the platform and services. Stackoverflow is also another place to get specific-issue technical support. We monitor all three of these forums, although they have different purposes.

Mars Lan

unread,
Oct 12, 2015, 7:18:22 PM10/12/15
to Google App Engine
Thanks for reporting, Alex. This is related to a known issue: https://code.google.com/p/googleappengine/issues/detail?id=12271
Reply all
Reply to author
Forward
0 new messages