summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/ajax/publicpreview.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing/ajax/publicpreview.php')
-rw-r--r--apps/files_sharing/ajax/publicpreview.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/files_sharing/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php
index 6ba47e5b3a6..0b2af7a6e59 100644
--- a/apps/files_sharing/ajax/publicpreview.php
+++ b/apps/files_sharing/ajax/publicpreview.php
@@ -15,6 +15,7 @@ $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;
$token = array_key_exists('t', $_GET) ? (string) $_GET['t'] : '';
+$keepAspect = array_key_exists('a', $_GET) ? true : false;
if($token === ''){
\OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST);
@@ -69,6 +70,10 @@ if(substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
+if ($keepAspect === true) {
+ $maxY = $maxX;
+}
+
if($maxX === 0 || $maxY === 0) {
\OC_Response::setStatus(\OC_Response::STATUS_BAD_REQUEST);
\OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
@@ -83,8 +88,9 @@ try{
$preview->setMaxX($maxX);
$preview->setMaxY($maxY);
$preview->setScalingUp($scalingUp);
+ $preview->setKeepAspect($keepAspect);
- $preview->show();
+ $preview->showPreview();
} catch (\Exception $e) {
\OC_Response::setStatus(\OC_Response::STATUS_INTERNAL_SERVER_ERROR);
\OC_Log::write('core', $e->getmessage(), \OC_Log::DEBUG);