If you’ve visited my site more than once, you might start to notice that the silly little tagline next to the logo in my header changes, in both content and appearance.
This is accomplished by way of a fancy little bit of PHP. The image generation uses the GD library (with FreeType support), and the fonts are all TrueType.
Again, since my Linode didn’t come with anything preinstalled, I needed to install GD first. It seemed like it might be a bit of a pain - the PHP manual page indicates I was going to have to recompile PHP. Fortunately, this was not the case.
I just had to download it from Ubuntu’s package manager…
apt-get install php5-gd
…and add it to the “extensions” section of php.ini…
nano /etc/php5/apache2/php.ini extension=gd.so
…and restart Apache.
apache2ctl -k gracefulOnce that’s out of the way, creating the image was remarkably simple - especially since I found a ready-made script that did exactly what I wanted.
The code is pretty long, so hit the jump to see the rest.