Fixing background color
This commit is contained in:
parent
39e2f390f0
commit
7ca6dacb3b
|
@ -41,7 +41,7 @@ class Configuration implements ConfigurationInterface
|
||||||
->scalarNode('distortion')->defaultValue(true)->end()
|
->scalarNode('distortion')->defaultValue(true)->end()
|
||||||
->scalarNode('max_front_lines')->defaultValue(null)->end()
|
->scalarNode('max_front_lines')->defaultValue(null)->end()
|
||||||
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
->scalarNode('max_behind_lines')->defaultValue(null)->end()
|
||||||
->arrayNode('backgroundColor')->prototype('scalar')->end()
|
->arrayNode('background_color')->prototype('scalar')->end()
|
||||||
->end()
|
->end()
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -98,12 +98,12 @@ class CaptchaGenerator
|
||||||
$this->builder->setMaxFrontLines($options['max_front_lines']);
|
$this->builder->setMaxFrontLines($options['max_front_lines']);
|
||||||
$this->builder->setMaxBehindLines($options['max_behind_lines']);
|
$this->builder->setMaxBehindLines($options['max_behind_lines']);
|
||||||
|
|
||||||
if ($options['backgroundColor'] != array()) {
|
if ($options['background_color'] != array()) {
|
||||||
if (count($options['backgroundColor'])!=3) {
|
if (count($options['background_color'])!=3) {
|
||||||
throw new \RuntimeException('backgroundColor should be an array of r, g and b');
|
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]);
|
$this->builder->setBackgroundColor($color[0], $color[1], $color[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
* **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
|
* **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)
|
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 :
|
Example :
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.0",
|
"php": ">=5.3.0",
|
||||||
"gregwar/captcha": "v1.0.3"
|
"gregwar/captcha": "v1.0.4"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-0": {
|
"psr-0": {
|
||||||
|
|
Loading…
Reference in New Issue