diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -1812,9 +1812,24 @@ def urlify_commit_message(commit_text, r return literal(newtext) +def render_binary(repo_name, file_obj): + """ + Choose how to render a binary file + """ + filename = file_obj.name + + # images + for ext in ['*.png', '*.jpg', '*.ico', '*.gif']: + if fnmatch.fnmatch(filename, pat=ext): + alt = filename + src = url('files_raw_home', repo_name=repo_name, + revision=file_obj.commit.raw_id, f_path=file_obj.path) + return literal(''.format(alt, src)) + + def renderer_from_filename(filename, exclude=None): """ - choose a renderer based on filename + choose a renderer based on filename, this works only for text based files """ # ipython diff --git a/rhodecode/public/css/code-block.less b/rhodecode/public/css/code-block.less --- a/rhodecode/public/css/code-block.less +++ b/rhodecode/public/css/code-block.less @@ -199,7 +199,6 @@ div.diffblock { // BEGIN CODE-BODY STYLES .code-body { - background: white; padding: 0; background-color: #ffffff; position: relative; @@ -491,6 +490,11 @@ div.codeblock { // to have the intended size and to scroll. Should be simplified. width: 100%; overflow-x: auto; + + img.rendered-binary { + height: auto; + width: 100%; + } } } diff --git a/rhodecode/templates/files/files_source.mako b/rhodecode/templates/files/files_source.mako --- a/rhodecode/templates/files/files_source.mako +++ b/rhodecode/templates/files/files_source.mako @@ -57,9 +57,14 @@