]> git.ipfire.org Git - thirdparty/git.git/commitdiff
gitweb: Avoid overflowing page body frame with large images
authorAndrew Keller <andrew@kellerfarm.com>
Mon, 17 Feb 2014 14:25:13 +0000 (09:25 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Feb 2014 17:50:14 +0000 (09:50 -0800)
When displaying a blob in gitweb, if it's an image, specify constraints for
maximum display width and height to prevent the image from overflowing the
frame of the enclosing page_body div.

This change assumes that it is more desirable to see the whole image without
scrolling (new behavior) than it is to see every pixel without zooming
(previous behavior).

Signed-off-by: Andrew Keller <andrew@kellerfarm.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl
gitweb/static/gitweb.css

index 3bc0f0b5ca0995910e0e517b545b5fb9af626a8b..79057b7d0e4f6c76a9d9853be14bbef60fa9c1c0 100755 (executable)
@@ -7094,7 +7094,7 @@ sub git_blob {
        git_print_page_path($file_name, "blob", $hash_base);
        print "<div class=\"page_body\">\n";
        if ($mimetype =~ m!^image/!) {
-               print qq!<img type="!.esc_attr($mimetype).qq!"!;
+               print qq!<img class="blob" type="!.esc_attr($mimetype).qq!"!;
                if ($file_name) {
                        print qq! alt="!.esc_attr($file_name).qq!" title="!.esc_attr($file_name).qq!"!;
                }
index 3b4d83382306772ac0b62743b0e23094f3d9f257..3212601032622fef063f06066bd7131061de36d9 100644 (file)
@@ -32,6 +32,11 @@ img.avatar {
        vertical-align: middle;
 }
 
+img.blob {
+       max-height: 100%;
+       max-width: 100%;
+}
+
 a.list img.avatar {
        border-style: none;
 }