### bigword 1 #!/home/merlyn/bin/perl -wT 2 use strict; 3 $|++; 4 $ENV{PATH} = "/usr/bin:/usr/ucb"; 5 6 use GD; 7 8 srand; 9 10 my $num; 11 12 if ($< == 60001) { 13 open STDERR, ">/dev/null"; 14 print "Content-type: image/gif\n\n"; 15 } 16 17 if ($ENV{'QUERY_STRING'} =~ /^(\w{1,30})$/) { 18 $num = $1; 19 } else { 20 $num = "bogus"; 21 } 22 23 my $font = gdLargeFont; 24 my $char_x = $font->width; 25 my $char_y = $font->height; 26 27 my $jiggle = 4; 28 my $picture_x = (1 + $char_x) * length($num) + 1; 29 my $picture_y = (1 + $char_y) * 1 + $jiggle; 30 31 my $image = new GD::Image($picture_x, $picture_y); 32 my $background = $image->colorAllocate(127,127,127); 33 $image->transparent($background); 34 $image->interlaced('true'); 35 my $red = $image->colorAllocate(255,0,0); 36 37 my $x = 1; 38 my @chars = split //, $num; 39 while (@chars) { 40 my $char = shift @chars; 41 $image->string($font,$x,int(1+rand($jiggle)),$char,$red); 42 $x += $char_x + 1; 43 } 44 45 print $image->gif;