aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/js/filelist.js
diff options
context:
space:
mode:
authorNina Pypchenko <22447785+nina-py@users.noreply.github.com>2021-01-10 19:14:49 +1100
committernpmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>2021-01-14 17:36:17 +0000
commitc14638877c0bb0533a72842ccc7c73d88f5122f0 (patch)
treebac7b25321ce61e30b578f51a9692ff52955edc8 /apps/files/js/filelist.js
parent97743df3fcd6243f9b2755a4c86586b61a96e793 (diff)
downloadnextcloud-server-c14638877c0bb0533a72842ccc7c73d88f5122f0.tar.gz
nextcloud-server-c14638877c0bb0533a72842ccc7c73d88f5122f0.zip
Add "Crop image previews" setting to files
Added a new user setting that toggles cropping on image previews in grid view. True (default value): crops each image to a square. False: keep original aspect ratio. Signed-off-by: Nina Pypchenko <22447785+nina-py@users.noreply.github.com> Closes #18439. Signed-off-by: npmbuildbot-nextcloud[bot] <npmbuildbot-nextcloud[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r--apps/files/js/filelist.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 30bc35551d6..11d0bc4511d 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -252,7 +252,8 @@
this._filesConfig = OCA.Files.App.getFilesConfig();
} else {
this._filesConfig = new OC.Backbone.Model({
- 'showhidden': false
+ 'showhidden': false,
+ 'cropimagepreviews': true
});
}
@@ -291,6 +292,10 @@
}
});
+ this._filesConfig.on('change:cropimagepreviews', function() {
+ self.reload();
+ });
+
this.$el.toggleClass('hide-hidden-files', !this._filesConfig.get('showhidden'));
}
@@ -2215,6 +2220,12 @@
urlSpec.y = Math.ceil(urlSpec.y);
urlSpec.forceIcon = 0;
+ /**
+ * Images are cropped to a square by default. Append a=1 to the URL
+ * if the user wants to see images with original aspect ratio.
+ */
+ urlSpec.a = this._filesConfig.get('cropimagepreviews') ? 0 : 1;
+
if (typeof urlSpec.fileId !== 'undefined') {
delete urlSpec.file;
return OC.generateUrl('/core/preview?') + $.param(urlSpec);