summaryrefslogtreecommitdiffstats
path: root/apps/files/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2021-01-15 08:07:52 +0100
committerGitHub <noreply@github.com>2021-01-15 08:07:52 +0100
commitc80e007607ebffd6e1c6f2b2b02df049ba4575ff (patch)
tree4d2b9518214092c43a626fa1d01528f0a9e3547b /apps/files/lib
parent795881739e24ce5543ce2d479c82f0b0da6c794d (diff)
parentc14638877c0bb0533a72842ccc7c73d88f5122f0 (diff)
downloadnextcloud-server-c80e007607ebffd6e1c6f2b2b02df049ba4575ff.tar.gz
nextcloud-server-c80e007607ebffd6e1c6f2b2b02df049ba4575ff.zip
Merge pull request #25055 from nina-py/18439-add-crop-image-previews-setting
Add "Crop image previews" setting to files
Diffstat (limited to 'apps/files/lib')
-rw-r--r--apps/files/lib/Controller/ApiController.php14
-rw-r--r--apps/files/lib/Controller/ViewController.php2
2 files changed, 16 insertions, 0 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php
index 206ddbd6ed6..0cf261af726 100644
--- a/apps/files/lib/Controller/ApiController.php
+++ b/apps/files/lib/Controller/ApiController.php
@@ -281,6 +281,20 @@ class ApiController extends Controller {
}
/**
+ * Toggle default for cropping preview images
+ *
+ * @NoAdminRequired
+ *
+ * @param bool $crop
+ * @return Response
+ * @throws \OCP\PreConditionNotMetException
+ */
+ public function cropImagePreviews($crop) {
+ $this->config->setUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', (int)$crop);
+ return new Response();
+ }
+
+ /**
* Toggle default for files grid view
*
* @NoAdminRequired
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index 91075737525..364735437e4 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -296,6 +296,8 @@ class ViewController extends Controller {
$params['isIE'] = \OCP\Util::isIE();
$showHidden = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'show_hidden', false);
$params['showHiddenFiles'] = $showHidden ? 1 : 0;
+ $cropImagePreviews = (bool) $this->config->getUserValue($this->userSession->getUser()->getUID(), 'files', 'crop_image_previews', true);
+ $params['cropImagePreviews'] = $cropImagePreviews ? 1 : 0;
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
$params['appNavigation'] = $nav;
$params['appContents'] = $contentItems;