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? Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/ 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. Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104085 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(). Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104087 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. Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104096 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. Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104098 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 Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104101 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? Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104104 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. Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104108 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? Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104109 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. Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104110 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()? Link to comment https://forums.phpfreaks.com/topic/23044-gd-image-help/#findComment-104547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.