elpaisa Posted January 31, 2008 Share Posted January 31, 2008 Hi! I'm creating a function that takes values from database and puts these on an image and saves it as a new one, for now as i don't have much experience in GD i am writing it as simple as possible, everithing works fine without loading a font but i need to use arial black to write on the image. Here is the code: that works without loading the font: function createimage() { Header("Content-Type: image/gif"); $font = 'ariblk.ttf'; $font_size = 2; $string = 'ADDERALL'; $id = ImageCreateFromGif("images/pot.gif"); $black = ImageColorAllocate($id, 0, 0, 0); //imagettftext($id, $font_size, 35, 76, $font, $string, $black); ImageString($id, $font_size, 35, 76, $string, $black); ImageGIF($id,"images/new_pot.gif"); } createimage(); And here is the one i am trying with, for using the font: function createimage() { Header("Content-Type: image/gif"); $font = 'ariblk.ttf'; $font_size = 2; $string = 'ADDERALL'; $id = ImageCreateFromGif("images/pot.gif"); $black = ImageColorAllocate($id, 0, 0, 0); imagettftext($id, $font_size, 35, 76, $font, $string, $black); //ImageString($id, $font_size, 35, 76, $string, $black); ImageGIF($id,"images/new_pot.gif"); } createimage(); Quote Link to comment https://forums.phpfreaks.com/topic/88732-solved-help-loading-font-and-wrinting-on-image-gd/ Share on other sites More sharing options...
helraizer Posted January 31, 2008 Share Posted January 31, 2008 What problem actually occurs when you try to load the font? Sam Quote Link to comment https://forums.phpfreaks.com/topic/88732-solved-help-loading-font-and-wrinting-on-image-gd/#findComment-454567 Share on other sites More sharing options...
rhodesa Posted January 31, 2008 Share Posted January 31, 2008 and the file ariblk.ttf is in the same folder as the PHP file? Quote Link to comment https://forums.phpfreaks.com/topic/88732-solved-help-loading-font-and-wrinting-on-image-gd/#findComment-454572 Share on other sites More sharing options...
laffin Posted January 31, 2008 Share Posted January 31, 2008 When do you actually load up the font. gd supports two type of font files GD fonts (use imageloadfont) and PostScript Type 1 (use imagepsloadfont) not shure about True Type fonts, but found this Difference between TTF and PSF Well good luck Quote Link to comment https://forums.phpfreaks.com/topic/88732-solved-help-loading-font-and-wrinting-on-image-gd/#findComment-454584 Share on other sites More sharing options...
rhodesa Posted January 31, 2008 Share Posted January 31, 2008 with imagettftext() you provide the path the font file as the argument. you don't need to preload it Quote Link to comment https://forums.phpfreaks.com/topic/88732-solved-help-loading-font-and-wrinting-on-image-gd/#findComment-454595 Share on other sites More sharing options...
elpaisa Posted January 31, 2008 Author Share Posted January 31, 2008 Well, afther no response for a long time i tried all the possible coding and i've solved it Thanks!! function createimage() { Header("Content-Type: image/gif"); $id = ImageCreateFromGif("images/pot.gif"); $string = 'ADDERALL'; $black = ImageColorAllocate($id, "#000000"); ImageTTFText($id, 7, 0, 30, 88, $black, "AEASWFTE.TTF", $string); ImageTTFText($id, 7, 0, 31, 88, $black, "AEASWFTE.TTF", $string); ImageGIF($id,"images/new_pot.gif"); } createimage(); Quote Link to comment https://forums.phpfreaks.com/topic/88732-solved-help-loading-font-and-wrinting-on-image-gd/#findComment-454608 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.