$Digit_prefix="/var/www/html/pict/digit".$Type."/digit";
$Digit_width=0;
$Digit_height=0;
$Border=4;
$n=@imagecreatefrompng($Digit_prefix."0.png"); /* Attempt to open */
if($n)
{ /* See if it failed */
$Digit_width=imagesx($n);
$Digit_height=imagesy($n);
imagedestroy($n);
}
function Copyimagefromfile($d,$dx,$dy,$sx,$sy,$ssx,$ssy,$filename)
{
$n=imagecreatefrompng($filename);
if (!$n)
{
$n = imagecreate (Digit_width, Digit_height);
$bgc = imagecolorallocate ($n, 0, 0, 0);
imagefilledrectangle ($n, 0, 0, Digit_width, Digit_height, $bgc);
}
//Imagecolortransparent($n,$black);
imagecopy($d,$n,$dx,$dy,$sx,$sy,$ssx,$ssy);
imagedestroy($n);
return $n;
}
$str=sprintf("%d",$Number);
$Digits=strlen($str);
$w=$Digits*$Digit_width+$Border;
$h=$Digit_height+$Border;
$g=ImageCreate($w,$h);
$white=ImageColorAllocate($g,255,255,255);
$blue=ImageColorAllocate($g,0,0,255);
$grey=ImageColorAllocate($g,200,200,200);
$black=ImageColorAllocate($g,0,0,8);
ImageFilledRectangle($g,0,0,$w,$h,$black);
for($i=0;$i<$Digits;$i++)
Copyimagefromfile($g,$Border/2+$i*$Digit_width,$Border/2,0,0,$Digit_width,$Digit_height,$Digit_prefix.$str[$i].".png");
//Copyimagefromfile($g,$w-35,2,0,0,32,32,$Digit_dir+"man1.png");
//Imagecolortransparent($g,$black);
Header("Content-type: image/png");
ImagePng($g);
?>