1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 03:36:25 +02:00

gitweb: Avoid overflowing page body frame with large images

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>
This commit is contained in:
Andrew Keller 2014-02-17 09:25:13 -05:00 committed by Junio C Hamano
parent 5f95c9f850
commit 46a7471f0e
2 changed files with 6 additions and 1 deletions

View File

@ -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!"!;
}

View 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;
}