eXeCuTeR Posted November 16, 2007 Share Posted November 16, 2007 How can I change the font in GD? look what I've done so far: http://rsilsigs.100webspace.net/updating-sig.php?username=Borgerman I wanna change the font in here. How do I do it? Thanks. Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/ Share on other sites More sharing options...
pocobueno1388 Posted November 16, 2007 Share Posted November 16, 2007 Check out this function http://us.php.net/manual/en/function.imagettftext.php There are also plenty more you can look through here if thats not what you want http://us.php.net/gd Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392532 Share on other sites More sharing options...
eXeCuTeR Posted November 16, 2007 Author Share Posted November 16, 2007 It says there's an error when I use imagettftext. How to fix it? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392582 Share on other sites More sharing options...
pocobueno1388 Posted November 16, 2007 Share Posted November 16, 2007 Well, whats the error? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392606 Share on other sites More sharing options...
eXeCuTeR Posted November 16, 2007 Author Share Posted November 16, 2007 The image “http://rsilsigs.100webspace.net/updating-sig.php?username=niv” cannot be displayed, because it contains errors. Darn, I wanna change it to Arial. BTW, I'm using Linux, well, it doesn't affect it, right? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392613 Share on other sites More sharing options...
pocobueno1388 Posted November 16, 2007 Share Posted November 16, 2007 Post your code, I don't think your using it right. Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392625 Share on other sites More sharing options...
eXeCuTeR Posted November 16, 2007 Author Share Posted November 16, 2007 $im = imagecreatefrompng("image.png"); //path to image $color = imagecolorallocate($im, 0, 0, 0); // allocating a color $font = 'Arial.ttf' $overall = extract_single("Overall", "</tr>", $page); // Don't mind these lines.. $overall_stat_array = extract_multi("<td align=\"right\">", "</td>", $overall); // Don't mind these lines.. $overall_level = $overall_stat_array[2]; // Don't mind these lines.. imagettftext($im, 12, 0, 10, 20, $color, $font, $overall_level); Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392628 Share on other sites More sharing options...
pocobueno1388 Posted November 16, 2007 Share Posted November 16, 2007 Do you have header("Content-type: image/png"); at the top of your script? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392650 Share on other sites More sharing options...
pocobueno1388 Posted November 16, 2007 Share Posted November 16, 2007 I take that back...I just tried the example code from the manual, and I am getting the same error 0_o I have no idea why it's doing that... Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392656 Share on other sites More sharing options...
eXeCuTeR Posted November 16, 2007 Author Share Posted November 16, 2007 Anyone knows what's the problem? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-392954 Share on other sites More sharing options...
Wes1890 Posted November 16, 2007 Share Posted November 16, 2007 in order to load TTF fonts, you need to use imagettftext() http://us3.php.net/manual/en/function.imagettftext.php Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-393012 Share on other sites More sharing options...
eXeCuTeR Posted November 16, 2007 Author Share Posted November 16, 2007 in order to load TTF fonts, you need to use imagettftext() http://us3.php.net/manual/en/function.imagettftext.php ><" Read the previous posts, we were talking about it but there's an error. Any idea guys? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-393092 Share on other sites More sharing options...
eXeCuTeR Posted November 16, 2007 Author Share Posted November 16, 2007 Help? Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-393218 Share on other sites More sharing options...
MadTechie Posted November 17, 2007 Share Posted November 17, 2007 $font = 'Arial.ttf' to $font = dirname(__file__).'/Arial.ttf' <-- Check arial.ttf is in the same place as the script and its got the Cap A Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-393252 Share on other sites More sharing options...
eXeCuTeR Posted November 17, 2007 Author Share Posted November 17, 2007 Just to give it the right direction to the font and it'll work? I'm gonna try it now. I'll edit my post if it works, thanks Link to comment https://forums.phpfreaks.com/topic/77548-how-to-change-font-in-gd/#findComment-393445 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.