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
Did you know?Explore Trending and Topic pages for more stories like this.
// 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

PHP4 to PHP5 Conversion
Hi Everyone,

I am working on a site that is built up on PHP4 and each page is being started f

Backflush
I am looking for a report in SAP that would give me a list of all parts that are populated with a ba

How to load mysql (and other) extensions into PHP
How to load mysql (and other) extensions into PHP PHP Development forum discussing coding practices,

need help modifying script
Hi guys,

I'm fairly new to php and am having a bit of trouble modifying a script.

This

FAGL_FC_TRANSLATION FAS52 New GL ECC 6.0
Hello,

The new program for Translating GL Balances (FAS 52) gives the option to use diffe

Array question
Does anyone know how to create a program that takes the $ amount for 8 different departments and gi

Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r

Running a cron job through PHP/Apache?!
Hello all,
I have a PHP script which makes a cron file from user input. When i try to run the cro

PHP error. Need help urgently
Hi,

I am programming a php site and have a problem that i just cant find out how to fix. When

Anti Spam Code
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I

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