diff options
author | root <root@frank.tg14.gathering.org> | 2014-04-14 19:24:25 +0200 |
---|---|---|
committer | root <root@frank.tg14.gathering.org> | 2014-04-14 19:24:25 +0200 |
commit | 39537e4fd5f3751c23b5c24048ba422a4b735f6a (patch) | |
tree | b45d811d14d341c56a48dc588345867bcf825e67 | |
parent | eed87142a0a77ff3a7e2a35c299db94331ec0418 (diff) |
mod_perlify (and add strict+warnings)
-rwxr-xr-x | web/nms.gathering.org/nettkart.pl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/web/nms.gathering.org/nettkart.pl b/web/nms.gathering.org/nettkart.pl index f6eb04d..19e48d1 100755 --- a/web/nms.gathering.org/nettkart.pl +++ b/web/nms.gathering.org/nettkart.pl @@ -4,8 +4,12 @@ use GD; use Image::Magick; use DBI; use lib '../../include'; +use strict; +use warnings; use nms; +use File::Basename; my $cgi = CGI->new; +my $cwd = dirname($0); # Sekrit night-mode my $night = defined($cgi->param('night')); @@ -13,9 +17,9 @@ my $night = defined($cgi->param('night')); my $dbh = nms::db_connect(); GD::Image->trueColor(1); -my ($img, $text_img); -my $img = GD::Image->new('tg14-salkart.png'); +my $text_img; +our $img = GD::Image->new($cwd.'/tg14-salkart.png'); if ($night) { my ($width, $height) = ($img->width, $img->height); @@ -28,10 +32,9 @@ if ($night) { $text_img = GD::Image->new($width, $height, 1); $text_img->alphaBlending(0); $text_img->saveAlpha(1); - my $blank = $text_img->colorAllocateAlpha(0, 0, 0, 127); + $blank = $text_img->colorAllocateAlpha(0, 0, 0, 127); $text_img->filledRectangle(0, 0, $text_img->width - 1, $text_img->height - 1, $blank); } else { - $img = GD::Image->new('tg14-salkart.png'); $text_img = $img; } @@ -113,7 +116,7 @@ if ($night) { $magick->Gamma(gamma=>1.90); my $m2 = Image::Magick->new; - $m2->Read('tg14-salkart.png'); + $m2->Read($cwd.'/tg14-salkart.png'); $m2->Negate(); $m2->Composite(image=>$magick, compose=>'Atop'); |