updated captcha

This commit is contained in:
JT Smith 2008-12-16 23:05:38 +00:00
parent 80fdb029b5
commit 8c410104a0
2 changed files with 6 additions and 6 deletions

View file

@ -1,4 +1,5 @@
7.6.8
- Updated captcha images to be more legible.
7.6.7
- fixed #9263: Thingy possibleValues processing, and List type autodetection.

View file

@ -157,7 +157,7 @@ sub _changeOwner {
=head2 addFileFromCaptcha ( )
Generates a captcha image (125px x 26px) and returns the filename and challenge string (6 random characters). For more information about captcha, consult the Wikipedia here: http://en.wikipedia.org/wiki/Captcha
Generates a captcha image (200x x 50px) and returns the filename and challenge string (6 random characters). For more information about captcha, consult the Wikipedia here: http://en.wikipedia.org/wiki/Captcha
=cut
@ -165,10 +165,10 @@ sub addFileFromCaptcha {
my $self = shift;
my $error = "";
my $challenge;
$challenge.= ('A'..'Z')[rand(26)] foreach (1..6);
$challenge .= ('A'..'Z')[rand(26)] foreach (1..6);
my $filename = "captcha.".$self->session->id->generate().".gif";
my $image = Image::Magick->new();
$error = $image->Set(size=>'125x26');
$error = $image->Set(size=>'200x50');
if($error) {
$self->session->errorHandler->warn("Error setting captcha image size: $error");
}
@ -181,12 +181,11 @@ sub addFileFromCaptcha {
$self->session->errorHandler->warn("Error adding noise: $error");
}
# AddNoise generates a different average color depending on library. This is ugly, but the best I can see for now
my $textColor = '#222222';
$error = $image->Annotate(font=>$self->session->config->getWebguiRoot."/lib/default.ttf", pointsize=>30, skewY=>0, skewX=>0, gravity=>'center', fill=>$textColor, antialias=>'true', text=>$challenge);
$error = $image->Annotate(font=>$self->session->config->getWebguiRoot."/lib/default.ttf", pointsize=>40, skewY=>0, skewX=>0, gravity=>'center', fill=>'#ffffff', antialias=>'true', text=>$challenge);
if($error) {
$self->session->errorHandler->warn("Error Annotating image: $error");
}
$error = $image->Draw(primitive=>"line", points=>"0,5 105,21", stroke=>$textColor, antialias=>'true', strokewidth=>2);
$error = $image->Draw(primitive=>"line", points=>"5,5 195,45", stroke=>'#ffffff', antialias=>'true', strokewidth=>2);
if($error) {
$self->session->errorHandler->warn("Error drawing line: $error");
}