diff options
-rw-r--r-- | apps/files_sharing/js/public.js | 24 | ||||
-rw-r--r-- | core/js/oc-dialogs.js | 4 |
2 files changed, 15 insertions, 13 deletions
diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 1993efe7d73..4908968a937 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -159,9 +159,18 @@ OCA.Sharing.PublicApp = { }; this.fileList.generatePreviewUrl = function (urlSpec) { + urlSpec = urlSpec || {}; + if (!urlSpec.x) { + urlSpec.x = 36; + } + if (!urlSpec.y) { + urlSpec.y = 36; + } + urlSpec.x *= window.devicePixelRatio; + urlSpec.y *= window.devicePixelRatio; + urlSpec.x = Math.floor(urlSpec.x); + urlSpec.y = Math.floor(urlSpec.y); urlSpec.t = $('#dirToken').val(); - urlSpec.y = Math.floor(36 * window.devicePixelRatio); - urlSpec.x = Math.floor(36 * window.devicePixelRatio); return OC.generateUrl('/apps/files_sharing/ajax/publicpreview.php?') + $.param(urlSpec); }; @@ -293,15 +302,8 @@ $(document).ready(function () { if (window.Files) { // HACK: for oc-dialogs previews that depends on Files: - Files.lazyLoadPreview = function (path, mime, ready, width, height, etag) { - return App.fileList.lazyLoadPreview({ - path: path, - mime: mime, - callback: ready, - width: width, - height: height, - etag: etag - }); + Files.generatePreviewUrl = function (urlSpec) { + return App.fileList.generatePreviewUrl(urlSpec); }; } }); diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 52ed34f61ec..361cf2dff67 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -388,9 +388,9 @@ var OCdialogs = { c: original.etag, forceIcon: 0 }; - var previewpath = OC.generateUrl('/core/preview.png?') + $.param(urlSpec); + var previewpath = Files.generatePreviewUrl(urlSpec); // Escaping single quotes - previewpath = previewpath.replace(/'/g, "%27") + previewpath = previewpath.replace(/'/g, "%27"); $originalDiv.find('.icon').css({"background-image": "url('" + previewpath + "')"}); getCroppedPreview(replacement).then( function(path){ |