From e6f0d9887c0a7378562acc89e5cae7489ac49587 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sat, 26 Dec 2020 13:10:56 +0000 Subject: Implement Imagemagick resources consumption limiting (cherry picked from commit 36d89d02e13ed856de6bace89bfbed05205005db) --- include/photo/photo_driver.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/photo/photo_driver.php') 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 -- cgit v1.2.3