Sometimes it is useful to be able to display text on a page as an image on the fly. For example it allows you to take advantage of fonts unavailable on the user’s computer without having to embed them in large files, stop copy and pasting of protected text or to obscure information such as email addresses and telephone numbers from bots which would otherwise spam you or your users.
‘Dynamic Text Images’ is a set of functions and a WordPress plugin which allows you to easily embed, serve and cache text as images in any ttf font, hex color and size that you want. All images are transparent PNGs and suitable for use in CSS, image tags or anywhere else you would normally put an image.
The WordPress plugin installs a BBCode style shortcode which lets you generate a text image easily just by surrounding the desired text in a textimg block within any page or post you make. The plugin also installs an easy font manager into the ‘appearances’ section of your blog admin panel and automatically optimises itself to your setup – enabling encryption and caching if your host can handle it.
As a set of PHP functions, dynamic text images is easy to install and fast to get up and running on your site. We’ve provided two example scripts and thorough documentation to help you out – just copy, paste and edit! What’s great about the code is that it’s easy enough for anyone to use but versatile enough for professional use too.
As well as outputting just standard image text URLs which are generated on request by the user’s browser to a generate script. The functions also have the capability to output as Data URIs (http://en.wikipedia.org/wiki/Data_URI_scheme) – a format becoming increasingly popular.
The functions (and WordPress plugin) can optionally use encryption to protect your server from annoying users generating their own text using the generate script. This functionality requires your PHP installation has the mcrypt extension installed.