Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Freetype, Gd And An Error, I just can't get FreeType to work
rvalkass
post Jul 31 2006, 06:42 PM
Post #1


apt-get moo
Group Icon

Group: [MODERATOR]
Posts: 2,111
Joined: 28-May 05
From: Hertfordshire, England
Member No.: 7,593
Spam Patrol



Basically I have this code:

CODE

header("Content-type: image/png");
$bgimg = "bg.png";
$im = imagecreatefrompng($bgimg);
$number = rand(10,99);
$textcolour = imagecolorallocate($im, 255, 255, 255);
$font = "arial.ttf";
imagettftext($im, 65, 0, 5, 95, $textcolour, $font, $number);
imagepng($im);
imagedestroy($im);


Unfortunately all I get is the blank placeholder for an image (or the red X if you still use IE) rather than my actual image. I have honed the problem down to the imagettftext line, as I have tried replacing it with imagestring and it works OK. I think the problem is with the font, but I just can't work it out.

I know that for this to work you need the GD and FreeType libraries. Last time I checked (ages ago unsure.gif ) Trap17 had both these installed. Were the libraries removed, so we are just missing the libraries or have I done something wrong with my code?

Any help is greatly appreciated and thanks in advance.
Go to the top of the page
 
+Quote Post
electron
post Aug 1 2006, 04:10 AM
Post #2


Premium Member
********

Group: Members
Posts: 162
Joined: 10-May 06
Member No.: 23,375



Your GD version might not be supporting imagettftext function
Try the following function:

imagestring ( resource image, int font size, int x, int y, string s, int col )

This is supported by all versions of GD library.
But in this function the text that will be written over the Image will be a little ugly as u cant give the type of Font u want.

Hope this helps and have a good day.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. What Does This Error Mean?(3)
  2. Session Start() Problem(5)
  3. Trouble With Emailer.php(5)
  4. Php Parse Error(2)
  5. Fatal Error(3)
  6. Error When Using file_put_contents()(4)
  7. Weird Error Messages In Opera(2)
  8. Validation Error No Insert(3)
  9. Phpbb Install Error(2)
  10. Parse Error(1)
  11. Parse: Error Unexpected T_lnumber(4)
  12. Suppressing Mysql Error In Php(4)
  13. Php Error When Running Script(3)
  14. Php Form Help!(3)
  15. Uglymonkey Toplist Script(7)
  1. Detect Image Resolution Without Gd(1)
  2. Help Needed With Silly Error(8)
  3. Error Importing Sql Query Via Php(6)
  4. [forum] Double Posting Happening By An Error(3)
  5. Error With Joomla Template(1)
  6. Error On Emailer.php & Smtp.php At Phpbb(2)
  7. Php Fsockopen() Error(14)
  8. Phpbb2 Error(4)
  9. T_string Error Please Assist(5)
  10. Php Objects: Catchable Fatal Error(4)
  11. Mysql Error(3)


 



- Lo-Fi Version Time is now: 5th September 2008 - 11:51 PM