Hi guys,
i'm trying to create my dynamic signature. Everything went well except for the fact that I cannot use ImageTTFText();
Temoporarily I use Imagestring(); atm. This is the result:
http://puu.sh/1JDNv
My problem:
This is my source code:
Code:
<?PHP
header('Content-Disposition: filename=sig.png');
header('Content-Type: image/png');
function formatMilliseconds($milliseconds) {
$seconds = floor($milliseconds / 1000);
$minutes = floor($seconds / 60);
$hours = floor($minutes / 60);
$days = floor($hours / 24);
$milliseconds = $milliseconds % 1000;
$seconds = $seconds % 60;
$minutes = $minutes % 60;
$hours = $hours % 24;
if($days == 0){
$format = ' %uH %02uM %02uS';
$time = sprintf($format, $hours, $minutes, $seconds);
return rtrim($time, '0');
}else{
$format = '%uD %uH %02uM %02uS';
$time = sprintf($format, $days, $hours, $minutes, $seconds);
return rtrim($time, '0');
}
}
$db_handle = mysql_connect($server, $user_name, $pass_word);
$db_found = mysql_select_db($database, $db_handle);
if ($db_found) {
$SQL = "SELECT * FROM table1 WHERE ID=1";
$result = mysql_query($SQL);
if($result){
while ($db_field = mysql_fetch_assoc($result)){
$xp = $db_field['XP'];
$time = $db_field['Time'];
$logs = $db_field['Logs'];
}
$image = 'sig.png';
$img = imagecreatefrompng($image);
$main_color = imagecolorallocate($img, 63, 55, 18);
// putenv('GDFONTPATH=' . realpath('.'));
// imagettftext ($img ,10,0,160,80, $main_color ,"public_html/arialblack.ttf", "imagettftexttest")
imagestring($img ,5,160, 80,number_format($xp),$main_color);
imagestring($img ,5,180 , 115,formatMilliseconds($time * 1000),$main_color);
imagestring($img, 5,205,150,number_format($logs),$main_color);
imagestring($img, 5,125,190,'Coming soon..',$main_color);
imagepng($img);
imagedestroy($img);
}else
print "False";
}
else
print "DB not Found, please report this";
?>
the important section is this:
Code:
putenv('GDFONTPATH=' . realpath('.'));
imagettftext ($img ,10,0,160,80, $main_color ,"public_html/arialblack.ttf", "imagettftexttest")
whenever I run this piece of code this error pops up:
http://puu.sh/1JDQP
Anybody knows what the problem could be? i really would like to use ImageTTfText(); for a nicer font.