Jump to content

adding ttf to gd library script


mind-owner

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...