Jump to content

need help with captcha


tinman

Recommended Posts

So far I have gotten the background image to generate as randomly as i want but i cant seem to get text to show up. This is my code:

 

$im = imagecreate(400, 30);

$white = imagecolorallocate($im, 255, 0, 0);

$black = imagecolorallocate($im, 0, 0, 0);

imagefilledrectangle($im, 0, 0, 399, 29, $white);

$text = 'Testing...';

$font = 'arial.ttf';

imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

imagepng($im);

imagedestroy($im);

 

but when I try to load it, no text appears. Do I need to incorporate my own font file into it? If so how do i do that? Or is it something even more simple that I have missed? Thank you for your time and assistance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...