aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2020-12-26 13:10:56 +0000
committerMario <mario@mariovavti.com>2020-12-30 15:37:28 +0100
commite6f0d9887c0a7378562acc89e5cae7489ac49587 (patch)
tree939286e438ed6954a66a0ab9d77df4a436404296
parent2855d84fba34749529d42d7024b06a08603fca44 (diff)
downloadvolse-hubzilla-e6f0d9887c0a7378562acc89e5cae7489ac49587.tar.gz
volse-hubzilla-e6f0d9887c0a7378562acc89e5cae7489ac49587.tar.bz2
volse-hubzilla-e6f0d9887c0a7378562acc89e5cae7489ac49587.zip
Implement Imagemagick resources consumption limiting
(cherry picked from commit 36d89d02e13ed856de6bace89bfbed05205005db)
-rw-r--r--include/photo/photo_driver.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/photo/photo_driver.php b/include/photo/photo_driver.php
index 52f761b65..f61919eea 100644
--- a/include/photo/photo_driver.php
+++ b/include/photo/photo_driver.php
@@ -38,6 +38,10 @@ function photo_factory($data, $type = null) {
$v = Imagick::getVersion();
preg_match('/ImageMagick ([0-9]+\.[0-9]+\.[0-9]+)/', $v['versionString'], $m);
if(version_compare($m[1], '6.6.7') >= 0) {
+ $limits = get_config('system', 'imagick_limits', false);
+ if ($limits)
+ foreach ($limits as $k => $v)
+ IMagick::setResourceLimit($k, $v);
$ph = new PhotoImagick($data, $type);
} else {
// earlier imagick versions have issues with scaling png's