If you want to load a text file and create an image using that text it isn't too tough. If you want to take that text and
overlay an existing image, I'm not sure.
But if you just want to generate an image that has the text in whatever font, it's pretty straight-forward.
You can try somethign like the following to generate the image. If you want the content from a file just use fopen to open the file, then read from the pointer into a variable and use that variable as your text.
Here's a little sample code of something I have:
Code:
<?
header("Content-type: image/jpeg");
$s = 20;
$text = "";
if($_GET['s']) $s = addslashes($_GET['s']);
if($_GET['text']) $text = addslashes($_GET['text']);
if(!isset($s)) $s=11;
$size = imagettfbbox($s,0,"/path/to/fonts/BROOKLYN.TTF",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black, "/path/to/fonts/BROOKLYN.TTF", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white, "/path/to/fonts/BROOKLYN.TTF", $text);
imagejpeg($im, "", 75);
ImageDestroy($im);
?>
You can test it here:
http://fury-tech.com/tools/image.php?s=24&text=Hello
It accepts two _GET arguments, size and text. Size specifies the font size, text specifies the text to print.
Just an example, but it lays it out pretty simple. Good luck!