diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-05-05 10:12:40 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-05-05 10:12:40 +0200 |
commit | 341fcdc37a74b630ef7d47b5f0b336622c072ddc (patch) | |
tree | e2fbd468eebcbf93edf243fd0fa66ce24d2aeb74 /core | |
parent | d2754af7c39b2573db455e38e7700a338d979631 (diff) | |
parent | d163441f3e1d011c117eca54eb9d23c0b58a23a8 (diff) | |
download | nextcloud-server-341fcdc37a74b630ef7d47b5f0b336622c072ddc.tar.gz nextcloud-server-341fcdc37a74b630ef7d47b5f0b336622c072ddc.zip |
Merge pull request #8407 from owncloud/scale-pics-on-public-sharing-master
Images on public sharing get downscaled to increase use experience - thi...
Diffstat (limited to 'core')
-rw-r--r-- | core/ajax/preview.php | 8 | ||||
-rw-r--r-- | core/routes.php | 2 |
2 files changed, 9 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); diff --git a/core/routes.php b/core/routes.php index 74be8806120..5368fd45645 100644 --- a/core/routes.php +++ b/core/routes.php @@ -66,6 +66,8 @@ $this->create('core_tags_delete', '/tags/{type}/delete') $this->create('js_config', '/core/js/oc.js') ->actionInclude('core/js/config.php'); // Routing +$this->create('core_ajax_preview', '/core/preview') + ->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_preview', '/core/preview.png') ->actionInclude('core/ajax/preview.php'); $this->create('core_lostpassword_index', '/lostpassword/') |