diff --git a/CHANGELOG b/CHANGELOG index 3a6d206af..d4af572d9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ CHANGELOG Roundcube Webmail =========================== +- Center and scale images in attachment preview frame (#5421) - Added max_message_size option enforced when attaching files to a composed message (#4993) - Added Search button in quick search menus (#5312) - Implement "one click" attachment/messages/photo upload (#5024) diff --git a/program/js/app.js b/program/js/app.js index 0c86e36f6..aa5be1f84 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -348,6 +348,15 @@ function rcube_webmail() if (this.env.list_post) this.enable_command('reply-list', true); } + + // center and scale the image in preview frame + if (this.env.mimetype.startsWith('image/')) + $(this.gui_objects.messagepartframe).on('load', function() { + var css = 'img { max-width:100%; max-height:100%; } ' // scale + + 'body { display:flex; align-items:center; justify-content:center; height:100%; margin:0; }'; // align + + $(this).contents().find('head').append(''); + }); } // show printing dialog else if (this.env.action == 'print' && this.env.uid