function Txt2Png( $text)
{
$png2display = md5($text); $filenameforpng = $_SERVER['DOCUMENT_ROOT']."/cache/". $png2display . ".png";
$filename = "http://".$_SERVER['SERVER_NAME']."/cache/". $png2display . ".png";
if (!file_exists($filenameforpng)) # we dont need to create file twice (md5) {
# definitions
$font = $_SERVER['DOCUMENT_ROOT'] . "/fonts/open_sans_regular.ttf";
# create image / png
$fontsize = 20;
$textwerte[2] += 8;
$textwerte[5] = abs($textwerte[5]); $textwerte[5] += 4;
$textwerte[5] -= 2;
imagettftext ($image, $fontsize, 0, 3,$textwerte[5],$farbe_b, $font, $text); #display image
}
$text = "<img src='$filename' border='0' alt='email' />";
return $text;
}
/*а на вывод*/
echo Txt2Png("1234567890");