From 8c410104a0cd271b9c772199dcba3ef3031d8312 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Tue, 16 Dec 2008 23:05:38 +0000 Subject: [PATCH] updated captcha --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Storage.pm | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index da41956dc..1098780e7 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -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. diff --git a/lib/WebGUI/Storage.pm b/lib/WebGUI/Storage.pm index 5af596fdb..b7fc82b3c 100644 --- a/lib/WebGUI/Storage.pm +++ b/lib/WebGUI/Storage.pm @@ -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"); }