diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 18395a5..6d72a7f 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -41,7 +41,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('distortion')->defaultValue(true)->end() ->scalarNode('max_front_lines')->defaultValue(null)->end() ->scalarNode('max_behind_lines')->defaultValue(null)->end() - ->arrayNode('backgroundColor')->prototype('scalar')->end() + ->arrayNode('background_color')->prototype('scalar')->end() ->end() ; diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 900b756..4da833a 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -98,12 +98,12 @@ class CaptchaGenerator $this->builder->setMaxFrontLines($options['max_front_lines']); $this->builder->setMaxBehindLines($options['max_behind_lines']); - if ($options['backgroundColor'] != array()) { - if (count($options['backgroundColor'])!=3) { - throw new \RuntimeException('backgroundColor should be an array of r, g and b'); + if ($options['background_color'] != array()) { + if (count($options['background_color'])!=3) { + throw new \RuntimeException('background_color should be an array of r, g and b'); } - $color = $options['backgroundColor']; + $color = $options['background_color']; $this->builder->setBackgroundColor($color[0], $color[1], $color[2]); } diff --git a/README.md b/README.md index 75610d1..907ecb6 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ You can define the following configuration options globally or on the CaptchaTyp * **distortion**: enable or disable the distortion on the image (default=true, enabled) * **max_front_lines**, **max_behind_lines**: the maximum number of lines to draw on top/behind the image. `0` will draw no lines; `null` will use the default algorithm (the number of lines depends on the size of the image). (default=null) +* **background_color**: sets the background color, if you want to force it, this should be an array of r,g &b, for instance [255, 255, 255] will force the background to be white Example : diff --git a/composer.json b/composer.json index 2e2b0ce..9b80a7d 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ ], "require": { "php": ">=5.3.0", - "gregwar/captcha": "v1.0.3" + "gregwar/captcha": "v1.0.4" }, "autoload": { "psr-0": {