PHP Classes

DF_Captcha: Generate images for CAPTCHA validation

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 421 All time: 6,353 This week: 309Up
Version License PHP version Categories
class_captcha_df 1.0GNU General Publi...5.0PHP 5, Graphics, Validation, Security
Description Author

This class can be used to generate images for CAPTCHA validation.

It can generate an image with a random validation text over a noise background.

The generated image is served as the current script output in JPEG or PNG format.

The class returns the rendered text string for later validation.

It uses a configurable TrueType font to render the text. The text color, font size and rotation are also configurable parameters.

Picture of pugliese fabrizio
Name: pugliese fabrizio <contact>
Classes: 1 package by
Country: Italy Italy
Age: 34
All time rank: 3446136 in Italy Italy
Week rank: 587 Up28 in Italy Italy Up

Details
################################################# # # # class DF_Captcha for one simple captcha # # # # License : GPL # # # ################################################# This is a class for a one captcha! You can tell me: "Oneother captcha script?" I saw you: "This is more simple!" NB: this class 4 work need sans.ttf; if you hate it, you can change with what you want. But remenber you must change the param text_font; This class give you a simple captcha, without the need to save the image on your server! You can have a captcha in only 3 instruction: 1: $c = new DF_Captcha(372, 60, "fff"); #define a new instancies of class => you can define a new class without arg #es: new DF_Captcha(); => there is default arg 2: $c->drawImage(); #draw your image => you have your captcha ready 3: $code = $c->getCode(); #there is your code for verification Just simple! What do you want yet? What? You want to set the length of the code? You can do it! $c->setLenCode(7); #replace 7 with the number you want to set your length code You can modify this parameters of your choise You must do only this: $c->format = $param; #format of the image; are supported only png or jpeg because use of this captcha is prevalently 4 the web public $format = "png"; #distortion image with square - this is because so bot are more difficult see the image and the letter over the image public $noise_square = 1; #distortion image with little line - this is because so bot are more difficult see the image and the letter over the image public $noise_granular = 1; #font with text is writed - for change this you must put ttf in dir with the class public $text_font = "sans.ttf"; #this is not modifible public $text_font_size; #0 text color black - 1(default) text color random public $text_color_mode = 1; #1 fix dimension - 0.7 dimension between 70&100% ... public $text_size_mode = 0.8; #0 no rotation - 10 rotation between -10&+10 - 20 -20&+20 ... public $text_rotation_mode = 10; That's all! If the class is OK 4 you, please vote it on phpclasses.org!
  Files folder image Files  
File Role Description
Plain text file class.captcha.php Class DF_Captcha Class
Accessible without login Plain text file example.php Example Example
Accessible without login Plain text file readme.txt Doc. Readme - how use this class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:421
This week:0
All time:6,353
This week:309Up
User Comments (1)
That's a good class.
14 years ago (sherlock homes)
75%StarStarStarStar