diff --git a/CHANGELOG.md b/CHANGELOG.md
index b34a0a370be..40b7c2b6172 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+- Fix regression where printing/scaling/rotating image attachments was broken (#9571)
+
+## Release 1.6.8
+
- Managesieve: Protect special scripts in managesieve_kolab_master mode
- Fix newmail_notifier notification focus in Chrome (#9467)
- Fix fatal error when parsing some TNEF attachments (#9462)
diff --git a/program/js/app.js b/program/js/app.js
index b1c7430bc3b..dc44b039bbb 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -407,13 +407,11 @@ function rcube_webmail()
var contents = $(this).contents();
// do not apply styles to an error page (with no image)
- if (contents.find('img').length)
- contents.find('head').append(
- ''
- );
+ if (contents.find('img').length) {
+ contents.find('img').css({ maxWidth: '100%', maxHeight: '100%' });
+ contents.find('body').css({ display: 'flex', alignItems: 'center', justifyContent: 'center', height: '100%', margin: 0 });
+ contents.find('html').css({ height: '100%' });
+ }
});
}
// show printing dialog unless decryption must be done first
@@ -5712,9 +5710,7 @@ function rcube_webmail()
this.apply_image_style = function()
{
var style = [],
- head = $(this.gui_objects.messagepartframe).contents().find('head');
-
- $('#image-style', head).remove();
+ img = $(this.gui_objects.messagepartframe).contents().find('img');
$.each({scale: '', rotate: 'deg'}, function(i, v) {
var val = ref.image_style[i];
@@ -5722,8 +5718,7 @@ function rcube_webmail()
style.push(i + '(' + val + v + ')');
});
- if (style)
- head.append($('