This project has stopped.
A new version PHP Font Image Generator 2 is available.
A new version PHP Font Image Generator 2 is available.
Abstract
If you are tired working with Photoshop creating merely font images, this may help you.
This is a simple PHP script file which automatically creates a font image and returns its data stream. All things you have to do is to link this file in src attribute of img tag and to write some parameters on it.
Note that this requires PHP version over 3, gd library, t1lib, and your own PostScript Type 1 (.pfb) font file.
Parameter List
| string text | Content of text. |
|---|---|
| string font | Relative path of PostScript Type 1 (.pfb) font file. |
| string size | Font size. |
| float [lh] | Relative value of line height based on font size. Default is 1. |
| float [bl] | Relative value of base line based on font size. Default is 0. |
| string [color] | Font color. Default is '000000'. |
| string [bgcolor] | Background color. Default is 'ffffff'. |
| integer [alpha] | Alpha of text. 0 means texts are invisible. 100 means nothing. Default is 100. |
| integer [trim] | Trimming mode. Only the width of image is trimmed when this is 0. Width and Height are trimmed when 1, and line height and base line are neglected. Default is 0. |
| integer [trans] | Whether makeing background color transparent. This only works when output file type is gif or png. Default is 1. |
| string [type] | File type to output. 'jpeg' or 'png' or 'gif'. Default is 'gif'. |
| integer [pallete] | The number of color. This works only when output file type is 'gif' or 'png'. Default is 32. |
| integer [quality] | The quality of compression. This only works when output file type is 'jpeg'. Default is 80. |
These parameters can be set via HTTP GET method.
Example
<img src="drawtext.php?text=This+is+Example& font=../font/HelveticaNeueMedium.pfb& size=30& color=ffffff& bgcolor=111111& lh=1& bl=0.22& trans=0" alt="" />
This is experimental and I assume no responsibility for any probrem resulting from the use of this.
Download