From d4ec2a25d4b4148583ef7d080ac25efe8cf92801 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sat, 28 Apr 2018 19:24:14 +0200 Subject: [PATCH] Add default configuration for images (#1979) This patch allows configuring image processing instructions for all images. A use case is generating a fixed set of sizes (derivatives) for all images, without having to specify them in the content markdown. Example configuration in user/config/system.yaml: images: defaults: derivatives: "[300,600,1200]" --- system/src/Grav/Common/Helpers/Excerpts.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/system/src/Grav/Common/Helpers/Excerpts.php b/system/src/Grav/Common/Helpers/Excerpts.php index d774bcf46..3561bc365 100644 --- a/system/src/Grav/Common/Helpers/Excerpts.php +++ b/system/src/Grav/Common/Helpers/Excerpts.php @@ -294,6 +294,15 @@ class Excerpts if (Grav::instance()['config']->get('system.images.auto_fix_orientation')) { $actions[] = ['method' => 'fixOrientation', 'params' => '']; } + $defaults = Grav::instance()['config']->get('system.images.defaults'); + if (is_array($defaults) && count($defaults)) { + foreach ($defaults as $method => $params) { + $actions[] = [ + 'method' => $method, + 'params' => $params, + ]; + } + } // loop through actions for the image and call them foreach ($actions as $action) {