PDA

View Full Version : Small Tutorial on GD Library [Freetype]


mr e
23 May 2003, 04:28
Ok this is pretty much an addition of my previous thread about the GD Library (http://www.vbulletin.org/forum/showthread.php?s=&postid=372738). This is just a small tutorial on how to get Freetype to work since it took me far too long before I realized it came with PHP.

Requirements
PHP 4.3.1 (this comes with the GD Library & Freetype

This is actually pretty easy to get working and makes your text look way cool if you get a nice font :)

1) Create a folder on the server (in my case it was /fonts) and put the .ttf file in there.

2)

//Instead of this
//ImageString(resource image, int font, int x, int y, string s, int col);
//Ex:
ImageString($img, 1, 230, 60, 'Text', $white);

//You need to do this
//ImageTTFText(resource image, int size, int angle, int x, int y, int color, string fontfile, string text);
//Ex:
ImageTTFText($img, 10, 0, 210, 65, $white, 'PATH/TO/FONT/FILE.ttf', 'Text');


As you can see it's really not that hard, but it took me forever and a day to figure out how to do this, and it really improves the look of your text :D Have fun!

mr e
23 May 2003, 05:28
Can I ask why this was moved? It has nothing to do with Hacking vBulletin, only to do with PHP related topics. :confused:

Xenon
23 May 2003, 12:55
it belongs to hins and tips, and therefore you can find it here more easyly than where it was before :)

mr e
23 May 2003, 18:31
Well, ok guess that works :)

TheEnd
04 Aug 2003, 04:09
What does this do?