fix unreadable captcha with Image::Magick
This commit is contained in:
parent
ac539ced57
commit
16fbdaec26
2 changed files with 5 additions and 2 deletions
|
|
@ -89,11 +89,13 @@ sub addFileFromCaptcha {
|
|||
if($error) {
|
||||
$self->session->errorHandler->warn("Error adding noise: $error");
|
||||
}
|
||||
$error = $image->Annotate(font=>$self->session->config->getWebguiRoot."/lib/default.ttf", pointsize=>30, skewY=>0, skewX=>0, gravity=>'center', fill=>'#666666', antialias=>'true', text=>$challenge);
|
||||
# AddNoise generates a different average color depending on library. This is ugly, but the best I can see for now
|
||||
my $textColor = $graphicsPackage eq 'Image::Magick' ? '#222222' : '#666666';
|
||||
$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);
|
||||
if($error) {
|
||||
$self->session->errorHandler->warn("Error Annotating image: $error");
|
||||
}
|
||||
$error = $image->Draw(primitive=>"line", points=>"0,5 105,21", stroke=>'#666666', antialias=>'true', strokewidth=>2);
|
||||
$error = $image->Draw(primitive=>"line", points=>"0,5 105,21", stroke=>$textColor, antialias=>'true', strokewidth=>2);
|
||||
if($error) {
|
||||
$self->session->errorHandler->warn("Error drawing line: $error");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue