Código PHP:
header("Content-type: image/gif");
$im = ImageCreate(100, 50);
$red = ImageColorAllocate($im, 255, 0, 0);
$white = ImageColorAllocate($im, 255, 255, 255);
$blue = ImageColorAllocate($im, 0, 0, 255);
$black = ImageColorAllocate($im, 0, 0, 0);
$gris = ImageColorAllocate($im, 125, 125, 125);
ImageFill($im, 0, 0, $gris);
// Escribimos el string en (210,30) en negro
//El 5 viene a ser el tamaño de la letra 1-5
$fuente = "/font/MiniForma.ttf";
$numero=$HTTP_GET_VARS["numero"];
ImageTTFText($im, 40,0, 5,40,$blue,$fuente, $numero);
// para calcular el grosor de la fuente
$font_width = ImageFontWidth($fuente);
// y calculamos la lingitud del strig
$string_width = $font_width * (strlen($numero));
// y añadimos la linia de subrallado en (210,50) en negro
while($a<10){
ImageLine($im, 0, $num, (210+$string_width), $num, $black);
$a++;
$num=$num+5;
}
while($as<30){
ImageLine($im, $numa, 0, $numa,(210+$string_width), $black);
$as++;
$numa=$numa+5;
}
imagegif($im);
imagedestroy($im);