Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question regarding font path in respect of imagettftext()

Status
Not open for further replies.

chunkII123

IS-IT--Management
Mar 18, 2009
78
US
Here is my issue, and I have scoured the internet all weekend trying to find the answer to my question -

I currently have about 114 websites on a shared hosting account via GoDaddy. They have PHP unlocked for any use - so on and so forth. What I am trying to do is this: Create the images on the various pages from a common folder, however the issue that I am having is setting the directory correctly to allow the font files to be loaded from said "common" folder. I have tried:

Code:
putenv('GDFONTPATH = '.$fontpath);
$fontpath = realpath($_SERVER['[URL unfurl="true"]http://www."xxxxx"*.com/common/fonts/"font"*.ttf'[/URL]]);

but that didn't work. I also tried:

Code:
$font = '[URL unfurl="true"]http://www."xxxxx"*.com/common/fonts/"font"*.ttf'[/URL]

Again, that didn't work. I'm currently at a loss for how to point the $fontpath to the right location. Is it possible to have the fonts reside on a different server? Or am I stuck uploading 114 copies of the same font to the differing site folders? Thank you everyone ahead of time!

Server specs:

Linux Hosting,
PHP v5.5,
GD v 2.3,
permissions set on everything to 775.

*the actual website name and font were removed for anonymity.

Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'
 
you need to use a file url instead. and of course you must set the variable $fontpath before setting putenv().

there is no requirement for the font to be on the same webroot. just to be accessible via file:// protocol, which should be normal for a godaddy installation.

and once you have set putenv() correctly remember that use must use the font names rather than the file names in your image* calls. i.e. leave off the .ttf
 
Worked like a charm. It's what I have been looking for all weekend! Thank you so much!

Beware of hackers bearing executables. Happy Hunting. 'irc.2600.net'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top