mind-owner Posted November 29, 2007 Share Posted November 29, 2007 header ("Content-type: image/png");$img_handle = imagecreatefrompng("1.png");$color1 = imagecolorallocate ($img_handle, 157, 157, 157);$font = "bob.ttf";$info = parse("usersname");imagestring ($img_handle, 3, 60, 37, $info['level'], $color1); When I try to put $font in the imagestring it stops workingEven when I replace Imagestring by imagettftextPlease help!!!ThanksMind-owner Link to comment Share on other sites More sharing options...
killboy Posted November 29, 2007 Share Posted November 29, 2007 I've barely worked with images on PHP, but I think the problem might be in your font... Did you placed the .ttf file in C:\Windows\Fonts (if you're using Windows) ??? Link to comment Share on other sites More sharing options...
killboy Posted November 29, 2007 Share Posted November 29, 2007 Edit: I think I know what the problem is:If you wanna visualize the image you have to place the imagepng() function in the last line of your script: header ("Content-type: image/png");$img_handle = imagecreatefrompng("1.png");$color1 = imagecolorallocate ($img_handle, 157, 157, 157);$font = "bob.ttf";$info = parse("usersname");imagestring ($img_handle, 3, 60, 37, $info['level'], $color1);imagepng($img_handle); Link to comment Share on other sites More sharing options...
justsomeguy Posted November 29, 2007 Share Posted November 29, 2007 In the imagestring function the font parameter is supposed to be an integer. You're trying to give it a string that is the font name. If you want to use a TrueType font you need to use the imagettftext function, and PHP needs access to the font file. Check the reference page for notes about how to use it:http://www.php.net/manual/en/function.imagettftext.php Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.