Codebase list libgd-securityimage-perl / 910b2b1
[svn-upgrade] Integrating new upstream version, libgd-securityimage-perl (1.64) Krzysztof Krzyzaniak 17 years ago
10 changed file(s) with 108 addition(s) and 49 deletion(s). Raw diff Collapse all Expand all
00 Revision history for Perl extension GD::SecurityImage.
11
22 Time zone is GMT+2.
3
4 1.64 Wed Apr 25 21:01:49 2007
5 => Yet another test suite update for Image::Magick.
6 => New style "blank" added for evil purposes.
7 => Fixed a regex in demo.pl
38
49 1.63 Sat Feb 24 16:41:03 2007
510 => I didn't check the existence of Image::Magick in
99 t/06-version_magick.t
1010 t/98-gd.t
1111 t/99-magick.t
12 t/magick.pl
1213 t/t.api
1314 t/skip.test
1415 eg/demo.pl
00 ---
11 name: GD-SecurityImage
2 version: 1.63
2 version: 1.64
33 author:
44 - 'Burak Gursoy <burak@cpan.org>'
55 abstract: Security image (captcha) generator.
1313 provides:
1414 GD::SecurityImage:
1515 file: lib/GD/SecurityImage.pm
16 version: 1.63
16 version: 1.64
1717 GD::SecurityImage::GD:
1818 file: lib/GD/SecurityImage/GD.pm
1919 version: 1.50
2222 version: 1.37
2323 GD::SecurityImage::Styles:
2424 file: lib/GD/SecurityImage/Styles.pm
25 version: 1.20
25 version: 1.21
2626 generated_by: Module::Build version 0.2805
2727 meta-spec:
2828 url: http://module-build.sourceforge.net/META-spec-v1.2.html
2424
2525 # - - - - - - - - - - - - - - > S T A R T P R O G R A M < - - - - - - - - - - - - - - #
2626
27 $VERSION = '1.40';
27 $VERSION = '1.41';
2828
2929 use constant REQUIREDMODS => qw(
3030 DBI
6666 };
6767 }
6868
69 my $NOT_EXISTS = quotemeta "Object does not exist in the data store";
70
6971 run() if not caller; # if you require this, you'll need to call demo::run()
7072
7173 sub TEST_FONT_EXISTENCE {
144146 # IP and browser string to validate the session.
145147 # It is also possible to put a timeout value for security_code key.
146148 # But, all these and anything else are all beyond this demo...
147 if ( $@ && $@ =~ m{ \A Object does not exist in the data store }xms ) {
149 if ( $@ && $@ =~ m{ \A $NOT_EXISTS }xms ) {
148150 $create_ses->('new');
149151 }
150152
11 use strict;
22 use vars qw[$VERSION];
33
4 $VERSION = '1.20';
4 $VERSION = '1.21';
55
66 sub style_default {
77 $_[0]->_drcommon(" \ lines will be drawn ");
6060 $self->style_ellipse(@_) if not $self->{DISABLED}{ellipse}; # GD < 2.07
6161 $self->style_circle(@_);
6262 }
63
64 sub style_blank {}
6365
6466 sub _drcommon {
6567 my $self = shift;
33 use GD::SecurityImage::Styles;
44 use Carp qw(croak);
55
6 $VERSION = '1.63';
6 $VERSION = '1.64';
77
88 sub import {
99 my $class = shift;
625625 This is the combination of ellipse and circle styles. Draws both ellipses
626626 and circles.
627627
628 =item B<blank>
629
630 Draws nothing. See L</"OTHER USES">.
631
628632 =back
629633
630634 I<Note>: if you have a (too) old version of GD, you may not be able
978982 <td><img border="0" src="http://img521.imageshack.us/img521/7235/magickscramble03boxmb2.png" /></td>
979983 </tr>
980984
981
982985 <tr><td colspan="2">&#160;</td></tr>
983986 <tr>
984987 <td>Style: <b>circle</b>. Scrambled with a fixed angle.</td>
987990
988991 <tr>
989992 <td><img border="0" src="http://img139.imageshack.us/img139/7227/magickscramblefixed04cihd4.png" /></td>
990 <td><img border="0" src="http://img139.imageshack.us/img139/9484/magickscramblefixedinfooj6.png" /></td>
993 <td><img border="0" src="http://img440.imageshack.us/img440/2647/magickscramblefixed05elnz6.png" /></td>
991994 </tr>
992995
993996 <tr><td colspan="2">&#160;</td></tr>
10301033 </pre>
10311034 </p>
10321035
1036 <p>Images hosted by <a href="http://imageshack.us">ImageShack</a>.</p>
1037
10331038 =end html
10341039
1040 =head2 OTHER USES
1041
1042 C<GD::SecurityImage> drawing capabilities can also be used for
1043 I<counter image> generation or displaying arbitrary messages:
1044
1045 use CGI qw(header);
1046 use GD::SecurityImage 1.64; # we need the "blank" style
1047
1048 my $font = "StayPuft.ttf";
1049 my $rnd = "10.257"; # counter data
1050
1051 my $image = GD::SecurityImage->new(
1052 width => 140,
1053 height => 75,
1054 ptsize => 30,
1055 rndmax => 1, # keeping this low helps to display short strings
1056 frame => 0, # disable borders
1057 font => $font,
1058 );
1059
1060 $image->random( $rnd );
1061 # use the blank style, so that nothing will be drawn
1062 # to distort the image.
1063 $image->create( ttf => 'blank', '#CC8A00' );
1064 $image->info_text(
1065 text => 'You are visitor number',
1066 ptsize => 10,
1067 strip => 0,
1068 color => '#0094CC',
1069 );
1070 $image->info_text(
1071 text => '( c ) 2 0 0 7 m y s i t e',
1072 ptsize => 10,
1073 strip => 0,
1074 color => '#d7d7d7',
1075 y => 'down',
1076 );
1077
1078 my($data, $mime, $random) = $image->out;
1079
1080 binmode STDOUT;
1081 print header -type => "image/$mime";
1082 print $data;
1083
10351084 =begin html
10361085
10371086 <p>
1038 All images in this document are generously hosted by
1039 <a href="http://imageshack.us">ImageShack</a>
1040 <a href="http://imageshack.us"><img src="http://imageshack.us/img/imageshack.png" border="0" /></a>
1087 The generated graphic will be:
1088 <br/>
1089 <br/>
1090 <img src = "http://img101.imageshack.us/img101/4770/gdsicountered2.png"
1091 border = "0"
1092 alt = "Image Hosted by ImageShack.us" />
10411093 </p>
1094
1095 <p>Image hosted by <a href="http://imageshack.us">ImageShack</a>.</p>
10421096
10431097 =end html
10441098
00 #!/usr/bin/env perl -w
11 use strict;
2 use vars qw( $MAGICK_SKIP );
23 use Test;
34 use Cwd;
45
56 BEGIN {
6 eval "require Image::Magick";
7 my $skip = $@ ? "You don't have Image::Magick installed." : '';
7 do 't/magick.pl' || die "Can not include t/magick.pl: $!";
8
89 my %total = (
910 magick => 2,
1011 gd => 2,
2425
2526 # test if we've loaded the right library
2627 gd();
27 $skip ? skip_magick() : magick();
28 $MAGICK_SKIP ? skip_magick() : magick();
2829 exit;
2930
3031 sub gd {
3637 $class->import( backend => 'Magick' ); ok( $class->new->raw->isa('Image::Magick') );
3738 }
3839 sub skip_magick {
39 skip($skip . " Skipping...", sub{1}) for 1..$total{magick};
40 skip( $MAGICK_SKIP . " Skipping...", sub{1}) for 1..$total{magick};
4041 }
4142 }
00 #!/usr/bin/env perl -w
11 use strict;
2 use vars qw( $MAGICK_SKIP );
23 use Test;
34 use Cwd;
45
56 BEGIN {
6 eval "require Image::Magick;";
7 my $skip;
8
9 if ( $@ ) {
10 $skip = "You don't have Image::Magick installed.";
11 }
12 elsif ($Image::Magick::VERSION lt '6.0.4') {
13 $skip = "There may be a bug in your PerlMagick version's "
14 ."($Image::Magick::VERSION) QueryFontMetrics() method. "
15 ."Please upgrade to 6.0.4 or newer.";
16 }
17 else {
18 $skip = '';
19 }
7 do 't/magick.pl' || die "Can not include t/magick.pl: $!";
208
219 my $TOTAL = 6;
2210 plan tests => $TOTAL;
2311
24 if ($skip) {
25 skip($skip . " Skipping...", sub{1}) for 1..$TOTAL;
12 if ( $MAGICK_SKIP ) {
13 skip( $MAGICK_SKIP . " Skipping...", sub{1}) for 1..$TOTAL;
2614 exit;
2715 }
2816 else {
00 #!/usr/bin/env perl -w
11 use strict;
2 use vars qw( %API );
2 use vars qw( %API $MAGICK_SKIP );
33 use Test;
44 use Cwd;
55
66 BEGIN {
7 eval "require Image::Magick;";
8 my $skip;
9
10 if ( $@ ) {
11 $skip = "You don't have Image::Magick installed.";
12 }
13 elsif ($Image::Magick::VERSION lt '6.0.4') {
14 $skip = "There may be a bug in your PerlMagick version's "
15 ."($Image::Magick::VERSION) QueryFontMetrics() method. "
16 ."Please upgrade to 6.0.4 or newer.";
17 }
18 else {
19 $skip = '';
20 }
7 do 't/magick.pl' || die "Can not include t/magick.pl: $!";
218
229 %API = (
2310 magick => 6,
3320
3421 plan tests => $total;
3522
36 if ($skip) {
37 skip($skip . " Skipping...", sub{1}) for 1..$total;
23 if ( $MAGICK_SKIP ) {
24 skip( $MAGICK_SKIP . " Skipping...", sub{1}) for 1..$total;
3825 exit;
3926 }
4027 else {
0 use strict;
1 use vars qw($MAGICK_SKIP);
2 BEGIN {
3 eval "require Image::Magick;";
4 if ( $@ ) {
5 $MAGICK_SKIP = "You don't have Image::Magick installed.";
6 $MAGICK_SKIP .= " $@";
7 }
8 elsif ( $Image::Magick::VERSION lt '6.0.4') {
9 $MAGICK_SKIP = "There may be a bug in your PerlMagick version's "
10 . "($Image::Magick::VERSION) QueryFontMetrics() method. "
11 . "Please upgrade to 6.0.4 or newer.";
12 }
13 else {
14 $MAGICK_SKIP = '';
15 }
16 }
17
18 1;