Schrift
[thread]11441[/thread]

GD::SecurityImage

Leser: 10


<< >> 6 Einträge, 1 Seite
esskar
 2008-03-09 20:48
#106859 #106859
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
captcha test

funzt nicht so wirklich;
hier meine parameter

Code: (dl )
1
2
3
4
5
6
7
8
9
new => {
width => 80,
height => 30,
lines => 7,
gd_font => 'giant',
},
create => [ qw/ normal rect / ],
particle => [ 100 ],
out => { force => 'jpeg' }
esskar
 2008-03-09 21:11
#106861 #106861
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
hat sich erledigt.
hab mir selbst ins knie geschossen ;)
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.
bianca
 2014-07-20 17:40
#176525 #176525
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
2008-03-12T16:32:33 bloonix
nur so am Rande... ich hab bei mir auch noch sowas testweise liegen:

Hab eben mal dieses alte Script von Bloonix probiert und hab zwei Fragen:
a) Wie bekomme ich die Meldung "Possible attempt to put comments in qw() list at test.pl line 34." weg?
b) Was muss ich ändern, damit lesbare PNG's rauskommen? Mein IrfanView sagt, die Datei sei defekt.
10 print "Hallo"
20 goto 10
GwenDragon
 2014-07-21 09:01
#176527 #176527
User since
2005-01-17
14546 Artikel
Admin1
[Homepage]
user image
2014-07-20T15:40:30 bianca
2008-03-12T16:32:33 bloonix
nur so am Rande... ich hab bei mir auch noch sowas testweise liegen:

Hab eben mal dieses alte Script von Bloonix probiert und hab zwei Fragen:
a) Wie bekomme ich die Meldung "Possible attempt to put comments in qw() list at test.pl line 34." weg?

Statt
Code (perl): (dl )
$image->create(qw/ttf rect #660000 #eeeeee/);

dann
Code (perl): (dl )
$image->create('ttf', 'rect', '#660000', '#eeeeee');


Oder die spezielle Warnung kurzfristig abschalten:
Code (perl): (dl )
1
2
3
no warnings 'qw';
$image->create(qw/ttf rect #660000 #eeeeee/);
use warnings;


2014-07-20T15:40:30 bianca
b) Was muss ich ändern, damit lesbare PNG's rauskommen? Mein IrfanView sagt, die Datei sei defekt.
Ich nehme mal an dass
Code (perl): (dl )
binmode STDOUT;
fehlt.
Steht sogar in den BeispielenCPAN:GD::SecurityImage drin ;)
Last edited: 2014-07-21 09:06:32 +0200 (CEST)
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

bianca
 2014-07-21 16:49
#176530 #176530
User since
2009-09-13
6978 Artikel
BenutzerIn

user image
Klappt, danke GwenDragon!
10 print "Hallo"
20 goto 10
<< >> 6 Einträge, 1 Seite



View all threads created 2008-03-09 20:48.