October 8, 2006

GD TTF PCDTR in PHP

I’d been having a lot of trouble getting my Ubuntu machine to render TTFs with GD in PHP. So much trouble that I’d even tried crazy things like recompiling PHP. Luckily I found this post on excitris.com and I was able to solve all of my problems with one line of code. Since the code on their site is completely mangled, here it is:

putenv('GDFONTPATH=' . realpath('.'));

Now I can use dynamic text replacement without going insane.

2 Responses

  1. 1 pht3k

    hi,

    it seems to be exactly what i am looking for. i am also going crazy, trying to recompile php under ubuntu. i search how to get ttf working under gd using apt-get commands, without success.

    i have a question regarding your post. which file do i have to modify? php.ini?

    thanks,
    pht3k

  2. 2 joey

    just put that line in your actual php file above your GD code.

Leave a Reply