summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2014-03-14 14:25:28 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-03-14 14:25:28 -0700
commit3a66e1bf9c45ac16169c3b6d4a096d5af3ba6929 (patch)
treeb18bfe33c2caa9b9305214fb50e70b0117aa664e
parentMerge branch 'tr/diff-submodule-no-reuse-worktree' (diff)
parentgitweb: Avoid overflowing page body frame with large images (diff)
downloadtgif-3a66e1bf9c45ac16169c3b6d4a096d5af3ba6929.tar.xz
Merge branch 'ak/gitweb-fit-image'
Instead of allowing an <img> to be shown in whatever size, force scaling it to fit on the page with max-height/max-width css style attributes. * ak/gitweb-fit-image: gitweb: Avoid overflowing page body frame with large images
-rwxr-xr-xgitweb/gitweb.perl2
-rw-r--r--gitweb/static/gitweb.css5
2 files changed, 6 insertions, 1 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3bc0f0b5ca..79057b7d0e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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!"!;
}
diff --git a/gitweb/static/gitweb.css b/gitweb/static/gitweb.css
index 3b4d833823..3212601032 100644
--- a/gitweb/static/gitweb.css
+++ b/gitweb/static/gitweb.css
@@ -32,6 +32,11 @@ img.avatar {
vertical-align: middle;
}
+img.blob {
+ max-height: 100%;
+ max-width: 100%;
+}
+
a.list img.avatar {
border-style: none;
}