captcha error


Posted on 16th Feb 2014 07:03 pm by admin

I have been trying to implement a captcha in php...

here is the code..
Code: (php) [Select]<?php
// Set the content-type
header('Content-type: image/png');

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = 'arial.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

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

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

But in the browser, it gives the following error...
QuoteThe image “http://127.0.0.1:9000/img1.php” cannot be displayed, because it contains errors.
Somebody tell me the reason and how to fix this ..

No comments posted yet

Your Answer:

Login to answer
158 Like 26 Dislike
Previous forums Next forums
Other forums

Automatically Detect Phone Model for WAP Jar Deployment
Making a wap site is fairly simple, but I'd like to know if there's a way to make it so that the wap

Need help to modify php ELSE code
I'm trying to find a way to have the php code display a message if there is no inventory listed in t

php mysql query from input textbox
Hi,

I have a text box, in that i have given the mysql query. I can able to get the query in v

PHP friend keyword equivalent
is there a PHP equivalent for the C++ friend keyword?

Calling strings from other php class
I have test1.php{
$string1;
$string2;
....
... //10 strings in this class <

Registration
ok so i have a site where people can register and login which works now thanks to someone on here th

asking for direction
I have 2 tables in my data, which are "post" and "event"
I won't make a summa

My XSRF Prevention code isn't working
First of all, thanks for the generous help you guys have given me in the past on this forum.
Seco

losing variables between php brackets
Hi

have got this code:
Code: $id=mysql_result($result,0,"itemid");
$title=mys

Problem with a select distinct
I have a problema with a select distinct, I have the next sql:

select distinct a,b,c,d fr

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash