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 d12d212a2e6..d8c892f1b7f 100644
--- a/apps/files_sharing/ajax/publicpreview.php
+++ b/apps/files_sharing/ajax/publicpreview.php
@@ -16,6 +16,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(400); //400 Bad Request
@@ -70,6 +71,10 @@ if(substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
+if ($keepAspect === true) {
+ $maxY = $maxX;
+}
+
if($maxX === 0 || $maxY === 0) {
\OC_Response::setStatus(400); //400 Bad Request
\OC_Log::write('core-preview', 'x and/or y set to 0', \OC_Log::DEBUG);
@@ -84,8 +89,9 @@ 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);