From 374ddbff55719ee42986383e6700e01370d68627 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 17 Jan 2015 12:11:52 +0100 Subject: show animated gifs on public sharing page --- apps/files_sharing/js/public.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'apps/files_sharing/js') diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index cbd135028f1..bec43a4fb57 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -97,7 +97,17 @@ OCA.Sharing.PublicApp = { }; var img = $(''); - if (previewSupported === 'true' || mimetype.substr(0, mimetype.indexOf('/')) === 'image' && mimetype !== 'image/svg+xml') { + + var fileSize = parseInt($('#filesize').val(), 10); + var maxGifSize = parseInt($('#maxSizeAnimateGif').val(), 10); + + if (mimetype === 'image/gif' && + (maxGifSize === -1 || fileSize <= (maxGifSize * 1024 * 1024))) { + img.attr('src', $('#downloadURL').val()); + img.appendTo('#imgframe'); + } else if (previewSupported === 'true' || + mimetype.substr(0, mimetype.indexOf('/')) === 'image' && + mimetype !== 'image/svg+xml') { img.attr('src', OC.filePath('files_sharing', 'ajax', 'publicpreview.php') + '?' + OC.buildQueryString(params)); img.appendTo('#imgframe'); } else if (mimetype.substr(0, mimetype.indexOf('/')) !== 'video') { -- cgit v1.2.3