From 8ff4a66f0150624b8b08c4c47765016bd2e3a2ab Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Fri, 12 Jun 2015 18:50:21 +0200 Subject: [PATCH 1/2] Determine the size we need before asking for a thumbnail We need to set the size of the preview using the devicePixelRatio and use that as arguments when using the preview endpoint or that endpoint will use the default 36x36 and thumbnails will be blurry on high DPI devices --- apps/files_sharing/js/public.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 6261c70626..32a469414d 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -159,6 +159,8 @@ OCA.Sharing.PublicApp = { this.fileList.generatePreviewUrl = function (urlSpec) { urlSpec.t = $('#dirToken').val(); + urlSpec.y = 36 * window.devicePixelRatio; + urlSpec.x = 36 * window.devicePixelRatio; return OC.generateUrl('/apps/files_sharing/ajax/publicpreview.php?') + $.param(urlSpec); }; From 7b84343cfc998e1e110965079fbe9581423125dd Mon Sep 17 00:00:00 2001 From: Olivier Paroz Date: Fri, 12 Jun 2015 18:56:18 +0200 Subject: [PATCH 2/2] floats are not welcome when setting the size of a preview --- apps/files_sharing/js/public.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 32a469414d..5923e426f0 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -89,8 +89,8 @@ OCA.Sharing.PublicApp = { // dynamically load image previews var token = $('#sharingToken').val(); var bottomMargin = 350; - var previewWidth = $(window).width() * window.devicePixelRatio; - var previewHeight = ($(window).height() - bottomMargin) * window.devicePixelRatio; + var previewWidth = Math.floor($(window).width() * window.devicePixelRatio); + var previewHeight = Math.floor(($(window).height() - bottomMargin) * window.devicePixelRatio); previewHeight = Math.max(200, previewHeight); var params = { x: previewWidth, @@ -159,8 +159,8 @@ OCA.Sharing.PublicApp = { this.fileList.generatePreviewUrl = function (urlSpec) { urlSpec.t = $('#dirToken').val(); - urlSpec.y = 36 * window.devicePixelRatio; - urlSpec.x = 36 * window.devicePixelRatio; + 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); };