summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-09-30 15:23:16 +0200
committerLukas Reschke <lukas@owncloud.com>2014-09-30 15:49:49 +0200
commit306bf71c62c7ef0fe30c297da6aea54db0177ba4 (patch)
treeada3278d5065cfd0b1368755d62816e9481cf6ef /apps/files_sharing/js
parent5292a14cdfa9efe6d9220b341f3261fe72c39b17 (diff)
downloadnextcloud-server-306bf71c62c7ef0fe30c297da6aea54db0177ba4.tar.gz
nextcloud-server-306bf71c62c7ef0fe30c297da6aea54db0177ba4.zip
Use SVG previews for public sharing
Fixes https://github.com/owncloud/core/pull/11367#issuecomment-57306037 and https://github.com/owncloud/core/issues/9218
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/public.js31
1 files changed, 20 insertions, 11 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js
index 1a2394f300e..b3036254401 100644
--- a/apps/files_sharing/js/public.js
+++ b/apps/files_sharing/js/public.js
@@ -56,6 +56,11 @@ OCA.Sharing.PublicApp = {
}
var mimetype = $('#mimetype').val();
+ var mimetypeIcon = $('#mimetypeIcon').val();
+ mimetypeIcon = mimetypeIcon.substring(0, mimetypeIcon.length - 3);
+ mimetypeIcon = mimetypeIcon + 'svg';
+
+ var previewSupported = $('#previewSupported').val();
if (typeof FileActions !== 'undefined') {
// Show file preview if previewer is available, images are already handled by the template
@@ -68,21 +73,25 @@ OCA.Sharing.PublicApp = {
}
}
+
// dynamically load image previews
- if (mimetype.substr(0, mimetype.indexOf('/')) === 'image') {
-
- var params = {
- x: $(document).width() * window.devicePixelRatio,
- y: $(document).height() * window.devicePixelRatio,
- a: 'true',
- file: encodeURIComponent(this.initialDir + $('#filename').val()),
- t: $('#sharingToken').val(),
- scalingup: 0
- };
+ var params = {
+ x: $(document).width() * window.devicePixelRatio,
+ y: $(document).height() * window.devicePixelRatio,
+ a: 'true',
+ file: encodeURIComponent(this.initialDir + $('#filename').val()),
+ t: $('#sharingToken').val(),
+ scalingup: 0
+ };
- var img = $('<img class="publicpreview">');
+ var img = $('<img class="publicpreview">');
+ if (previewSupported === 'true' || mimetype.substr(0, mimetype.indexOf('/')) === 'image') {
img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params));
img.appendTo('#imgframe');
+ } else if (mimetype.substr(0, mimetype.indexOf('/')) !== 'video') {
+ img.attr('src', OC.Util.replaceSVGIcon(mimetypeIcon));
+ img.attr('width', 128);
+ img.appendTo('#imgframe');
}
if (this.fileList) {