diff options
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); |