chiark / gitweb /
provide width and height attributes for imgs
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 20 Jul 2010 11:25:12 +0000 (12:25 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 20 Jul 2010 11:25:12 +0000 (12:25 +0100)
cgi

diff --git a/cgi b/cgi
index 1d29b1d91a7e64fb6f6ce079b899e7305dc79249..f95567d67579a6691aa620e18786c0086dd9953c 100755 (executable)
--- a/cgi
+++ b/cgi
@@ -397,13 +397,16 @@ sub num_param ($$$$) {
 
 our $group= param('graph');
 
+my $defwidth= 370;
+my $defheight= 200;
+
 our $elem= param('elem');
 if (defined $elem) {
     my $g= $graphs{$section,$group,$elem};
     die unless $g;
 
-    my $width= num_param('w',370,100,1600);
-    my $height= num_param('h',200,100,1600);
+    my $width= num_param('w',$defwidth,100,1600);
+    my $height= num_param('h',$defheight,100,1600);
 
     my $sloth= param('sloth');
     die unless defined $sloth;
@@ -489,7 +492,7 @@ if (defined $detail) {
            my $imgurl= "$self?graph=$detail&section=$section".
                "&sloth=$tsloth&elem=$elem";
            print a({href=>"$imgurl&w=780&h=800"},
-                   img({src=>$imgurl, alt=>''}));
+                   img({src=>$imgurl, alt=>'', width=>780, height=>800}));
        }
     }
     print end_html();
@@ -535,7 +538,7 @@ foreach my $group (@{ $section_groups{$section} }) {
     foreach my $elem (@$elems) {
        my $g= $graphs{$ref_section,$ref_group,$elem};
        print img({src=>"$imgurl&elem=$elem&sloth=".($sloth + $g->{Slower}),
-                  alt=>''});
+                  alt=>'', width=>$defwidth, height=>$defheight});
     }
     print "</span>";
     print "</a>\n";