Need to test this Captcha on somebody"s Perl
am 09.12.2005 19:52:46 von DFSOk, here it goes. My server with Perl is kept and maintained at one of
those ISP warehouses. The truth is I am no SA, so couldn't build a Perl
setup.
I started using Authen::Captcha and needed more so added
GD::SecurityImage::AC. But what happened was that whenever I try to use a
TTF font, no text appears, and $@ contains
"libgd was not built with FreeType font support "
My server people said they did the rebuild twice "The first time I used the
source RPM... the second time I
used the latest source provided by GD's website" and that settles it on
their end.
As for the font path or file itself being good, we're using the same path
and file on a simple PHP file, so that's all good.
Here is what I was wondering. Does anyone have a Perl system setup that can
run the script below? It is very short, and if you alternate between TTF &
Normal (lines 38 & 39) you either get a full captcha image or one with no
text and an error.
I have to try something to find out what is wrong here.
Thanks.
#!/usr/bin/perl
use warnings;
use strict;
use CGI;
use GD::SecurityImage::AC;
no warnings 'uninitialized';
my $q = new CGI;
my ($md5sum) = MakeCaptcha();
my $errr = $@;
my $out = $errr;
$out .= qq^
^;
print $q->header();
print $out;
exit 0;
sub MakeCaptcha
{
my $number_of_characters = 4;
my $captcha = Authen::Captcha->new();
$captcha->gdsi(new => {
lines => 2,
width => 132,
height => 57,
scramble => 0,
angle => 45,
font => "/usr/local/fonts/comic.ttf",
ptsize => 12,
},
create=> [ttf=>'defualt', '#3333AA', '#AA3333'],
# create=> [normal=>'defualt', '#3333AA', '#AA3333'],
);
$captcha->data_folder('../cap_data');
$captcha->output_folder('../cap_output');
$captcha->debug(2);
my ($md5sum,$chars) = $captcha->generate_code( $number_of_characters );
return $md5sum;
}