redarrow Posted March 14, 2007 Share Posted March 14, 2007 hi there i got this gd code from php.net all works grate, But i wanted to add a font so i downloadded a font and it's called font.ttf now i need to no how to add it to the below code, each time i try i get a long funny error. The font and picture are in the same folder as this code any advise please cheer. Like i say without the font i can see the picture and the letters on top. why dont this work! <?php header("Content-type: image/png"); $string="hell i am redarrow"; $im = imagecreatefrompng("mat_picture.png"); $orange = imagecolorallocate($im, 220, 210, 60); $px = (imagesx($im) - 7.5 * strlen($string)) / 2; //font needs to be added. //$font = imageloadfont("font.ttf"); // some were on this line the varable font needs adding. imagestring($im, 3, $px, 9, $string, $orange); imagepng($im); imagedestroy($im); ?> Link to comment https://forums.phpfreaks.com/topic/42672-solved-adding-a-font-to-my-gd-code-please-help-cheers/ Share on other sites More sharing options...
redarrow Posted March 14, 2007 Author Share Posted March 14, 2007 solved. Done it lol i read the phpfreaks totural grate stuff <?php $im = imagecreatefrompng("mat_picture.png"); $yellow = ImageColorAllocate ($im, 235, 235, 51); $saying="hi there i am redarrow"; ImageTTFText ($im, 15, 1, 25, 70, $yellow, "/WINDOWS/Fonts/IMPACT.ttf", "$saying"); ImagePNG($im); ?> Link to comment https://forums.phpfreaks.com/topic/42672-solved-adding-a-font-to-my-gd-code-please-help-cheers/#findComment-207083 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.