Page 1 of 1

PHP and using fonts with GD

Posted: Sat Nov 04, 2006 1:36 pm
by Stanger
First time poster here. Hope this makes sense and is able to be answered.

I am coding a script that uses gd to create an image. In a perfect world, the user will be able to enter text, choose a font from a dropdown menu and submit the info to the script that generates their custom image.

Thus, I have a question.

In order for this to work, do the fonts have to be ones installed on the USERS pc?

My reason for asking this is that, so far, my script will not use ANY font that is not installed. I am working in a Windows invironment but have attempted to set the font directory using putenv( 'GDFONTPATH='.realpath('./fonts') );. The fonts inside that directory are not installed on my machine. Maybe I am not doing something right with that piece of code? Is this possible without having the fonts "installed" on the PC running the server?

I have written several scripts using PHP, but never have I used anything with GD or fonts. This area is still very new to me and any help with this is much appreciated.

Stanger

Posted: Sat Nov 04, 2006 1:39 pm
by Burrito
Moved to GD.

the fonts would have to be installed on the server. I believe GD only works with TTF fonts using the imagettftext() function

Posted: Sat Nov 04, 2006 1:48 pm
by Stanger
My appologies for not looking harder at the forum descriptions.

Thanks for the info. That makes a world of difference for this script :)

Very much appreciated!

Stanger