mirror of
https://github.com/getgrav/grav.git
synced 2026-03-04 19:41:36 +01:00
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]"
This commit is contained in:
committed by
Andy Miller
parent
027dbcf6fa
commit
d4ec2a25d4
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user