I wrote a bit of code to gather all the .ttf files in the directory with this script, and randomize them to write text on a header image for my site. The only catch is the font files have to be named 1.ttf, 2.ttf etc etc.
<?php
srand((double)microtime()*1234567); $image = imagecreatefromjpeg(rand(1,exec('ls *.jpg | wc -l')) . ".jpg"); $font = rand(1,exec('ls *.ttf | wc -l')) . ".ttf"; $textcolor = imagecolorallocate($image,0,0,0); $text1 = "shenko.homedns.org"; imagettftext($image, 50, 0, 20, 50, $textcolor, $font, $text1); header("Content-type: image/jpeg"); imagejpeg($image,'',90); imagedestroy($image); ?>