PHP Classes

Captcha Numbers V2.1: Generate CAPTCHA validation images

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (7)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 5,460 All time: 458 This week: 75Up
Version License PHP version Categories
captchanumbersv21 2.3GNU General Publi...5Graphics, Validation, Security


This class can generate images for use in CAPTCHA based validation tests (Completely Automated Public Turing test to tell Computers from Humans Apart). It is an improved version of the Captcha Numbers class originally written by Hadar Porat.

This version can generate a random text string that includes letters and digits.

It can also display each of text characters in different vertical positions randomly defined.

The colors of the grid and the text characters alternate to make it more difficult for robots to guess what is the text written in the image.

New features as of 2006 March 7th:
- random pixel display (by default set to 10% of the pixels of the entire
image); if random selected pixel has background color then a random color is
selected for the random pixel, otherwise a close match of the letter's or
grid's color is generated
- removed grid display by default (it's better readable without the grid,
but it can be added, my suggestion is to add more dots instead of the grid)
- random grid color support
- added random display angle support
- added random font support
- added random font size support
- added random font color support

- replaced rand function calls with mt_rand (mt_rand suppose to be better
and faster, if I remember correctly)

Next to the class PHP file create a folder fonts and place TTF in order to use the random fonts feature.

Picture of Albert Demeter
  Performance   Level  
Name: Albert Demeter <contact>
Classes: 1 package by
Country: United Kingdom
Age: 45
All time rank: 54629 in United Kingdom
Week rank: 332 Up16 in United Kingdom Up


GD2 Problems ------------ You must have GD2 module installed with PHP. If u get imagecreate() not found, it's means you don't have GD2 installed. You can install it easly on windows by open php.ini and uncomment extension=php_gd2.dll line. Also check that extension_dir in php.ini is correct. Font Problems ------------- You must have arial.ttf available for the script to work. If the picture is shown without numbers (only grid) u need to download arial.ttf from Save arial.ttf in the same directory of the script. Notice it's arial.ttf and not Arial.ttf.

  • screen1.jpg
  • screenshot.png
  Files folder image Files  
File Role Description
Plain text file captcha_numbersV2.php Class Main Class
Accessible without login Plain text file example.php Example Image displayer
Accessible without login HTML file loginexample.php Example Login Form Example
Accessible without login Plain text file readme.txt Doc. Readme

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:458
This week:75Up
User Ratings User Comments (2)
 All time
This package works fine, issue composer install as captcha_nu...
3 years ago (Mark Thompson)
14 years ago (kishore kumar)