Thread GD::SecurityImage (5 answers)
Opened by esskar at 2008-03-09 20:48

bloonix
 2008-03-12 17:32
#106983 #106983
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
nur so am Rande... ich hab bei mir auch noch sowas testweise liegen:

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use strict;
use warnings;
use GD::SecurityImage;

my $image = GD::SecurityImage->new(
width => 420,
height => 100,
ptsize => 30,
lines => 30,
scramble => 1,
thickness => 1,
gd_font => 'giant',
bgcolor => '#eeeeee',
font => '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf',
send_ctobg => 1,
);

my @rand = (
{ rand => 10, plus => 48 },
{ rand => 25, plus => 65 },
{ rand => 25, plus => 97 },
);

my $string = ();

for (0..5) {
my $r = rand(@rand);
$string .= chr(rand($rand[$r]{rand})+$rand[$r]{plus});
}

$image->random($string);

# method, style, text_color, line_color
$image->create(qw/ttf rect #660000 #eeeeee/);
$image->particle(600);

my ($image_data, $mime_type, $random_number) = $image->out(force => 'png');

print "Content-Type: image/$mime_type\n\n";
print $image_data;


das sieht so aus: Link zu captcha.cgi
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread GD::SecurityImage