<?PHP
Header ("Content-type: image/jpeg");
// Create either from JPG or draw the face
$Image = $HTTP_GET_VARS["img"];
$im = "";
// MODIFY the images path, so it points to your pictures
if (! empty ($Image))
$im = ImageCreateFromJPEG ($DOCUMENT_ROOT."/textures/".$Image.".jpg");
if ($im == "")
{
$im = ImageCreate (256,256);
$UseImg = false;
}
else
$UseImg = true;
$tmp = $HTTP_GET_VARS["tc"]; // text color
if (empty ($tmp))
$r = $g = $b = 0x00;
else
{
$r = hexdec (substr ($tmp, 0, 2));
$g = hexdec (substr ($tmp, 2, 2));
$b = hexdec (substr ($tmp, 4, 2));
}
$fore = ImageColorAllocate ($im, $r, $g, $b);
if (! $UseImg)
{
$tmp = $HTTP_GET_VARS["bc"]; // background color
if (empty ($tmp))
$r = $g = $b = 0xff;
else
{
$r = hexdec (substr ($tmp, 0, 2));
$g = hexdec (substr ($tmp, 2, 2));
$b = hexdec (substr ($tmp, 4, 2));
}
$back = ImageColorAllocate ($im, $r, $g, $b);
imagefill ($im, 1, 1, $back);
}
$size = $HTTP_GET_VARS["s"]; // size
if ($size == 0)
$size = 10;
$list = explode("|", $HTTP_GET_VARS["t"]); // text
$pos = $size / 1.5;
foreach ($list as $line)
{
$line = strtr ($line, "^", " ");
ImageTTFText ($im, $size, 0, 0, $pos, $fore, "./FONTNAME.ttf", $line);
$pos = $pos + $size;
}
ImageJPEG ($im);
ImageDestroy ($im);
?>