From 6bc4c9b40a6d1ee211ff04e5e050e8fb9605781f Mon Sep 17 00:00:00 2001 From: Dayan Date: Sat, 10 Oct 2020 00:19:36 +0300 Subject: [PATCH 1/3] image presets can now be arrays --- classes/image/driver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/image/driver.php b/classes/image/driver.php index 0e8e221a86..b733d180e2 100644 --- a/classes/image/driver.php +++ b/classes/image/driver.php @@ -83,10 +83,10 @@ public function config($index = null, $value = null) public function preset($name) { $vars = func_get_args(); - if (isset($this->config['presets'][$name])) + if (\Arr::get($this->config['presets'], $name)) { $old_config = $this->config; - $this->config = array_merge($this->config, $this->config['presets'][$name]); + $this->config = array_merge($this->config, \Arr::get($this->config['presets'], $name)); foreach ($this->config['actions'] AS $action) { $func = $action[0]; From 6a12f851c252a102c5d606d8ac6d4474be3415c4 Mon Sep 17 00:00:00 2001 From: Dayan Date: Sat, 10 Oct 2020 09:52:45 +0300 Subject: [PATCH 2/3] added multilevel image config example --- config/image.php | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/config/image.php b/config/image.php index 4e569539c1..e8a137da43 100644 --- a/config/image.php +++ b/config/image.php @@ -22,7 +22,7 @@ * */ -return array( +return [ /** * ------------------------------------------------------------------------- * Driver @@ -167,16 +167,33 @@ * * Example: * - * 'example' => array( + * 'example' => [ * 'quality' => 100, * 'bgcolor' => null, - * 'actions' => array( - * array('crop_resize', 200, 200), - * array('border', 20, "#f00"), - * array('rounded', 10), - * array('output', 'png') - * ) - * ) + * 'actions' => [ + * ['crop_resize', 200, 200], + * ['border', 20, "#f00"], + * ['rounded', 10], + * ['output', 'png'] + * ] + * ], + * 'example_multilevel' => [ + * 'thumbnail' => [ + * 'quality' => 100, + * 'bgcolor' => null, + * 'actions' => [ + * ['crop_resize', 175, 175] + * ] + * ], + * 'preview' => [ + * 'quality' => 100, + * 'bgcolor' => null, + * 'actions' => [ + * ['crop_resize', 200, 400] + * ] + * ] + * ] + * * * [!] WARNING: * @@ -185,5 +202,5 @@ * */ - 'presets' => array(), -); + 'presets' => [], +]; From 1362056e79a927a89c416765393380db3d6bd94f Mon Sep 17 00:00:00 2001 From: Dayan Date: Tue, 20 Oct 2020 11:14:41 +0300 Subject: [PATCH 3/3] fixed array code styling --- config/image.php | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/config/image.php b/config/image.php index e8a137da43..50e4e7aaec 100644 --- a/config/image.php +++ b/config/image.php @@ -22,7 +22,7 @@ * */ -return [ +return array( /** * ------------------------------------------------------------------------- * Driver @@ -167,32 +167,32 @@ * * Example: * - * 'example' => [ + * 'example' => array( * 'quality' => 100, * 'bgcolor' => null, - * 'actions' => [ - * ['crop_resize', 200, 200], - * ['border', 20, "#f00"], - * ['rounded', 10], - * ['output', 'png'] - * ] - * ], - * 'example_multilevel' => [ - * 'thumbnail' => [ + * 'actions' => array( + * array('crop_resize', 200, 200), + * array('border', 20, "#f00"), + * array('rounded', 10), + * array('output', 'png') + * ) + * ), + * 'example_multilevel' => array( + * 'thumbnail' => array( * 'quality' => 100, * 'bgcolor' => null, - * 'actions' => [ - * ['crop_resize', 175, 175] - * ] - * ], - * 'preview' => [ + * 'actions' => array( + * array('crop_resize', 175, 175) + * ) + * ), + * 'preview' => array( * 'quality' => 100, * 'bgcolor' => null, - * 'actions' => [ - * ['crop_resize', 200, 400] - * ] - * ] - * ] + * 'actions' => array( + * array('crop_resize', 200, 400) + * ) + * ) + * ) * * * [!] WARNING: @@ -202,5 +202,5 @@ * */ - 'presets' => [], -]; + 'presets' => array(), +);