$img = ImagePwd::new (%inp);
%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.
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.
NAME
ImagePwd.pm - Full featured Image password generator
for
Web
DESCRIPTION
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 rotate chars on random angle (0 up to 90)
- 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.
SYNOPSIS
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;
"Content-type: image/png\n\n"
;
$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"
);
$img
->Write(
'png:-'
);
?>
AUTHOR
Julian Lishev - Bulgaria, Sofia,
e-mail: julian
@proscriptum
.com,
www.proscriptum.com