Deserteye Posted October 5, 2006 Share Posted October 5, 2006 I need help on this script:[code]<?phpheader ("Content-type: image/png");$image = imagecreatefrompng("project.png");$color = imagecolorallocate($image, 255, 255, 255);$font = imageloadfont("verdana.ttf");$string = "Text here";imagestring($image, $font, 9, 10, $string, $color);imagepng($image);imagedestroy($image);?>[/code]It gives me an error saying there is something wrong with it. The problem is that when I try to load the font (imageloadfont()), thats when it gives me an error. But when I take the imageloadfont() function out, its ok but the font looks bad. So how do I load the verdana font? Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 Can you verify that the font exists? Make sure it is case sensitive. Quote Link to comment Share on other sites More sharing options...
brendandonhue Posted October 5, 2006 Share Posted October 5, 2006 imageloadfont() is expecting a .gdf file. You're probably looking for imagettftext(). Quote Link to comment Share on other sites More sharing options...
Deserteye Posted October 5, 2006 Author Share Posted October 5, 2006 [quote author=brendandonhue link=topic=110551.msg447036#msg447036 date=1160014862]imageloadfont() is expecting a .gdf file. You're probably looking for imagettftext().[/quote]I tried that as well and I got an error too.Yes the verdana.ttf does exist. Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 is it verdana.ttf or Verdana.ttf? You have said both now. Quote Link to comment Share on other sites More sharing options...
Deserteye Posted October 5, 2006 Author Share Posted October 5, 2006 [quote author=Hi I Am Timbo link=topic=110551.msg447049#msg447049 date=1160016179]is it verdana.ttf or Verdana.ttf? You have said both now.[/quote]what? its verdana.ttf yes Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 Do you get an error with the new function? What is it? Quote Link to comment Share on other sites More sharing options...
Deserteye Posted October 5, 2006 Author Share Posted October 5, 2006 [quote author=Hi I Am Timbo link=topic=110551.msg447055#msg447055 date=1160016549]Do you get an error with the new function? What is it?[/quote]The image “http://www.thesite.com/project.php” cannot be displayed, because it contains errors. Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 If you try and navigate to the image, what error does that give you? Quote Link to comment Share on other sites More sharing options...
Hi I Am Timbo Posted October 5, 2006 Share Posted October 5, 2006 I bet that is when you navigate there, nevermind. Can you var_dump the result?[b]edit[/b]I mean, catch what the imagettftext() is returning and var_dump that. Quote Link to comment Share on other sites More sharing options...
brendandonhue Posted October 5, 2006 Share Posted October 5, 2006 Can we see the code you tried with imagettftext()? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.