Dynamic Text to Image Generation using PHP and GD Library
in
This week we have been looking at dynamic image generation, particularly text to image generation. This technique can be very useful when creating particularly graphic heavy sites, that you need to control with a CMS or alter the text regularly.
The problem with interesting fonts on the web is that apart from the few that you can guareetee are supported correctly by the users browser very few work properly. To get around this we we could use Flash or create a compiled Image file, such as; jpegs or gif etc...
However it may be that you come back to a site a few weeks or even months later to replace the graphic or flash file and realise that you have forgotten, which font you used, or what size.
The answer we found was to write a class to convert text to image using the required font.
As you can see the above text is a non standard font being delivered to you, whats unusual about that i hear you say?Well nothing really except it is dynamically generated using a PHP File and can be linked into any CMS or framework. Dont forget the alt tags though!
An Improved free copy of our Text2Image PHP Class can be found below!
The problem with interesting fonts on the web is that apart from the few that you can guareetee are supported correctly by the users browser very few work properly. To get around this we we could use Flash or create a compiled Image file, such as; jpegs or gif etc...
However it may be that you come back to a site a few weeks or even months later to replace the graphic or flash file and realise that you have forgotten, which font you used, or what size.
The answer we found was to write a class to convert text to image using the required font.
As you can see the above text is a non standard font being delivered to you, whats unusual about that i hear you say?Well nothing really except it is dynamically generated using a PHP File and can be linked into any CMS or framework. Dont forget the alt tags though!
An Improved free copy of our Text2Image PHP Class can be found below!
| Attachment | Size |
|---|---|
| Text 2 Image PHP Class (TAR File) | 754 KB |

If you have a project, which has failed, stalled or been dropped.