seco Posted January 17, 2008 Share Posted January 17, 2008 Hi i ahave a ttf file and i want to use it in writting a text on the image and in the php hlp i see the function imageloadfont() and how it used and i write the following <?php // create a 100*30 image $im = imagecreate(100, 30); // white background and blue text $bg = imagecolorallocate($im, 255, 255, 255); $textcolor = imagecolorallocate($im, 0, 0, 255); // here i load a font file on the same directory of the script called myfont.ttf $font = imageloadfont("myfont.ttf"); imagestring($im, $font, 0, 0, "sometext", $textcolor); // output the image header("Content-type: image/png"); imagepng($im); ?> it gives me error message says:- The image “http://localhost/z.php” cannot be displayed, because it contains errors. any idea? thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/86441-imageloadfont-function-to-load-specific-ttf-file/ 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.