GD::SecurityImage 1.61 review

Download
by rbytes.net on

GD::SecurityImage is a security image (captcha) generator. SYNOPSIS use GD::SecurityImage; # Create a normal image

License: Perl Artistic License
File size: 59K
Developer: Burak Gursoy
0 stars award from rbytes.net

GD::SecurityImage is a security image (captcha) generator.

SYNOPSIS

use GD::SecurityImage;

# Create a normal image
my $image = GD::SecurityImage->new(width => 80,
height => 30,
lines => 10,
gd_font => 'giant');
$image->random($your_random_str);
$image->create(normal => 'rect');
my($image_data, $mime_type, $random_number) = $image->out;
or
# use external ttf font
my $image = GD::SecurityImage->new(width => 100,
height => 40,
lines => 10,
font => "/absolute/path/to/your.ttf",
scramble => 1);
$image->random($your_random_str);
$image->create(ttf => 'default');
$image->particle;
my($image_data, $mime_type, $random_number) = $image->out;

or you can just say (most of the public methods can be chained)

my($image, $type, $rnd) = GD::SecurityImage->new->random->create->particle->out;

to create a security image with the default settings. But that may not be useful. If you require the module, you must import it:

require GD::SecurityImage;
GD::SecurityImage->import;

The module also supports Image::Magick, but the default interface uses the GD module. To enable Image::Magick support, you must call the module with the use_magick option:

use GD::SecurityImage use_magick => 1;

If you require the module, you must import it:

require GD::SecurityImage;
GD::SecurityImage->import(use_magick => 1);

The module does not export anything actually. But import loads the necessary sub modules. If you don' t import, the required modules will not be loaded and probably, you'll die().

The (so called) "Security Images" are so popular. Most internet software use these in their registration screens to block robot programs (which may register tons of fake member accounts). Security images are basicaly, graphical CAPTCHAs (Completely Automated Public Turing Test to Tell Computers and Humans Apart). This module gives you a basic interface to create such an image. The final output is the actual graphic data, the mime type of the graphic and the created random string. The module also has some "styles" that are used to create the background (or foreground) of the image.

If you are an Authen::Captcha user, see GD::SecurityImage::AC for migration from Authen::Captcha to GD::SecurityImage.

This module is just an image generator. Not a captcha handler. The validation of the generated graphic is left to your programming taste.

Requirements:
Perl

GD::SecurityImage 1.61 keywords