%inp hash can contain follow members: len - Count of password string. width - Width of generated image. height - Height of generated image. f_max - Maximum size of font. f_min - Minimum size of font. fixed - If you want to use one color for all chars please set this to '1' other else to '0' rot - Maximum(minimum) rotate angle (0 up to 90) fonts - Pointer to array of fonts that will be used for image password. (NT users should specify full path to fonts!) bgcolor - Use only if you want to fix used bgcolor for image!!! color - Use only if you want to fix used color for text!!! quality - Quality of new generated image (variate of 0 up to 128) password - This member contain 'password' with length 'len' cell - Set to '1' if you want over image to be placed cells, drawn with random color.
Note: Font sizes variates from 'f_min' up to 'f_max' pixels.
ImagePwd.pm - Full featured Image password generator for Web
ImagePwd is written in pure Perl and generate images that can be used against automatic scripts: about registrations, submittions, flood and any multiple undesired actions.
Prerequirements: - PerlMagick package, often became with ImageMagick (http://www.imagemagick.org/)
Features: You can automatize many aspects of generated image:
- Length of password string. - Width of generated image. - Height of generated image. - Maximum size of font. - Minimum size of font. - You can use fixed color for all password chars. - You can rotate chars on random angle (0 up to 90) - To use array of fonts for generated image password. - To use one fixed bgcolor for image. - To use fixed color for text - To set quality level (variate of 0 up to 128) - To write your custom "password" text - To set over image cells, drawn with random color.
use ImagePwd; $obj = ImagePwd->new(len=>6, height=>60, width=>280, fixed=>1, rot=>10, quality=>128, cell=>1, f_min=>20); $obj->fonts(['c:/Windows/FONTS/Verdana.TTF','c:/Windows/FONTS/Arial.TTF', 'c:/Windows/FONTS/comic.TTF','c:/Windows/FONTS/georgiab.TTF', 'c:/Windows/FONTS/micross.TTF','c:/Windows/FONTS/tahoma.TTF', ]); # $obj->fonts(['kai.ttf']); # And more fonts for Unix/Linux users $img = $obj->ImagePassword(); $| = 1; binmode STDOUT; print "Content-type: image/png\n\n"; print $img->Write('png:-'); OR
<?perl use ImagePwd;
$obj = ImagePwd->new(len=>6, height=>60, width=>280, fixed=>1, rot=>10, quality=>128, cell=>1, f_min=>20); $obj->fonts(['c:/Windows/FONTS/Verdana.TTF','c:/Windows/FONTS/Arial.TTF', 'c:/Windows/FONTS/comic.TTF','c:/Windows/FONTS/georgiab.TTF', 'c:/Windows/FONTS/micross.TTF','c:/Windows/FONTS/tahoma.TTF', ]); # $obj->fonts(['kai.ttf']); # And more fonts for Unix/Linux users $img = $obj->ImagePassword(); ClearBuffer(); ClearHeader(); flush_print(1); set_printing_mode(''); Header(type=>'raw',val=>"Content-type: image/png\n\n"); print $img->Write('png:-');
?>
Julian Lishev - Bulgaria, Sofia, e-mail: julian@proscriptum.com, www.proscriptum.com
To install ShopCard, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ShopCard
CPAN shell
perl -MCPAN -e shell install ShopCard
For more information on module installation, please visit the detailed CPAN module installation guide.