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

OPINIONS WANTED
This is my login page code, and I want your opinion on it please!

Code: // Login ~ CHECKS

preg_replace question
Hello!!

I hope someone can help me with preg_replace.

I load two tables from an extern

Upload, SSL and more php help
I recently just installed a ssl cert and do i use https for the whole site or just for the checkout.

Retrieving the 25 most recently added entries from all tables in a MySQL databas
Hello,

The code below works great. It creates a table that shows the 25 most recently added t

PO Release Strategy Issue
Hi Experts,

I am facing an issue related to PO release strategy. The details are-
<

I need some help with the IF command...
I have a large number of images in one section of my website with the .jpg format. I'm adding a bun

please help me... my password gets encrypted but not able to get in database
hai guys,
please help me... in the following function my password gets encrypted but no

CODE NOT WORKING
Code: [Select]<?php
//include shared codes

include '../lib/common.php';
include

string to currency format
Hi guys...

Actually I chunk out some data from txtfile and one of the data contains amount va

MySql timezone
Code: $sql = "SELECT *, date_format(date, '%m/%d/%Y at %I:%i %p' )as date FROM comments WHERE t

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