diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-04-29 17:07:10 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-05-02 17:02:57 +0200 |
commit | 20893cc3b335049a144a53be24eaacb2e33a1480 (patch) | |
tree | c0795a4246bf6c38ec8b8ad9461e25b17ec9af74 /core/ajax | |
parent | 49d9631eee1616b9ae2846886c3d428236c5b81a (diff) | |
download | nextcloud-server-20893cc3b335049a144a53be24eaacb2e33a1480.tar.gz nextcloud-server-20893cc3b335049a144a53be24eaacb2e33a1480.zip |
Images on public sharing get downscaled to increase use experience - this will speed up loading time
- adding keep aspect to core/ajax/preview.php
- remove duplicate method Preview::show()
- no more hard coded mimetype of preview
- remove .png from the preview urls
- keep old route preview.png for backwards compatibility
- aspect preserving previews are now cached
Diffstat (limited to 'core/ajax')
-rw-r--r-- | core/ajax/preview.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/core/ajax/preview.php b/core/ajax/preview.php index 526719e8a1b..d38043707ac 100644 --- a/core/ajax/preview.php +++ b/core/ajax/preview.php @@ -11,6 +11,7 @@ $file = array_key_exists('file', $_GET) ? (string)$_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int)$_GET['x'] : '36'; $maxY = array_key_exists('y', $_GET) ? (int)$_GET['y'] : '36'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool)$_GET['scalingup'] : true; +$keepAspect = array_key_exists('a', $_GET) ? true : false; $always = array_key_exists('forceIcon', $_GET) ? (bool)$_GET['forceIcon'] : true; if ($file === '') { @@ -20,6 +21,10 @@ if ($file === '') { exit; } +if ($keepAspect === true) { + $maxY = $maxX; +} + if ($maxX === 0 || $maxY === 0) { //400 Bad Request \OC_Response::setStatus(400); @@ -36,9 +41,10 @@ try { $preview->setMaxX($maxX); $preview->setMaxY($maxY); $preview->setScalingUp($scalingUp); + $preview->setKeepAspect($keepAspect); } - $preview->show(); + $preview->showPreview(); } catch (\Exception $e) { \OC_Response::setStatus(500); \OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG); |