[Pkg-owncloud-commits] [owncloud] 63/90: add config-option for an image's maximum filesize when generating previews
David Prévot
taffit at moszumanska.debian.org
Fri Feb 6 21:10:55 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 56c51d481c8370d0171f4ebb073ed757ccb5c07e
Author: Georg Ehrke <developer at georgehrke.com>
Date: Mon Jan 19 00:22:55 2015 +0100
add config-option for an image's maximum filesize when generating previews
---
config/config.sample.php | 12 ++++++++++++
lib/private/preview/image.php | 7 +++++++
2 files changed, 19 insertions(+)
diff --git a/config/config.sample.php b/config/config.sample.php
index 0d3085d..673cede 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -604,6 +604,18 @@ $CONFIG = array(
* original size. A value of ``1`` or ``null`` disables scaling.
*/
'preview_max_scale_factor' => 10,
+
+/**
+ * max file size for generating image previews with imagegd (default behaviour)
+ * If the image is bigger, it'll try other preview generators,
+ * but will most likely show the default mimetype icon
+ *
+ * Value represents the maximum filesize in megabytes
+ * Default is 50
+ * Set to -1 for no limit
+ */
+'preview_max_filesize_image' => 50,
+
/**
* custom path for LibreOffice/OpenOffice binary
*/
diff --git a/lib/private/preview/image.php b/lib/private/preview/image.php
index c5f566a..acf7232 100644
--- a/lib/private/preview/image.php
+++ b/lib/private/preview/image.php
@@ -21,6 +21,13 @@ class Image extends Provider {
return false;
}
+ $maxSizeForImages = \OC::$server->getConfig()->getSystemValue('preview_max_filesize_image', 50);
+ $size = $fileInfo->getSize();
+
+ if ($maxSizeForImages !== -1 && $size > ($maxSizeForImages * 1024 * 1024)) {
+ return false;
+ }
+
$image = new \OC_Image();
if($fileInfo['encrypted'] === true) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list