diff options
| author | root <root@frank.tg14.gathering.org> | 2014-04-17 21:15:20 +0200 | 
|---|---|---|
| committer | root <root@frank.tg14.gathering.org> | 2014-04-17 21:15:20 +0200 | 
| commit | c1a1537272c3832e6fd2c8ca310d15f8b4142088 (patch) | |
| tree | d77e0a2f10b428b28cc9be3c562720b45341051a /web | |
| parent | 80977a88fde6f849f68c5864f18fe61a4b2dae64 (diff) | |
Use absolute paths for image storage
Diffstat (limited to 'web')
| -rwxr-xr-x | web/nms.gathering.org/showswitch.pl | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/web/nms.gathering.org/showswitch.pl b/web/nms.gathering.org/showswitch.pl index 5ed0029..0391a57 100755 --- a/web/nms.gathering.org/showswitch.pl +++ b/web/nms.gathering.org/showswitch.pl @@ -7,7 +7,9 @@ use strict;  use warnings;  use lib '../../include';  use nms; +use File::Basename;  my $cgi = CGI->new; +my $cwd = dirname($0);  my $switch = $cgi->param('id');  my $width = $cgi->param('width');  my $height = $cgi->param('height'); @@ -17,7 +19,7 @@ my $resthtml = "";  $width = 500 unless (defined($width));  $height = 250 unless (defined($height)); -require './mygraph.pl'; +require "$cwd/mygraph.pl";  my $start = [Time::HiRes::gettimeofday];  my $dbh = nms::db_connect(); @@ -72,8 +74,8 @@ while (my $ref = $q->fetchrow_hashref()) {  				plotseries($graph, \@x, \@y1, 255, 0, 0, $min_x, $max_y);  				plotseries($graph, \@x, \@y2, 0, 0, 255, $min_x, $max_y); -				open GRAPH, ">img/$filename" -					or die "img/$filename: $!"; +				open GRAPH, ">$cwd/img/$filename" +					or die "$cwd/img/$filename: $!";  				print GRAPH $graph->png;  				close GRAPH;  				exit; @@ -183,7 +185,7 @@ if ($pid == 0) {  	plotseries($graph, \@x, \@y1, 255, 0, 0, $min_x, $max_y);  	plotseries($graph, \@x, \@y2, 0, 0, 255, $min_x, $max_y); -	open GRAPH, ">img/$filename" +	open GRAPH, ">$cwd/img/$filename"  	or die "img/$filename: $!";  	print GRAPH $graph->png;  	close GRAPH; @@ -201,11 +203,10 @@ plotseries($graph, \@totx, \@toty1, 255, 0, 0, $min_x, $max_ty);  plotseries($graph, \@totx, \@toty2, 0, 0, 255, $min_x, $max_ty);  $filename = "$switch-$width-$height.png"; -open GRAPH, ">img/$filename" or die "img/$filename: $!"; +open GRAPH, ">$cwd/img/$filename" or die "img/$filename: $!";  print GRAPH $graph->png;  close GRAPH; -  # Wait for all the other graphs to be done  while (waitpid(-1, 0) != -1) {  	1; | 
