options to fine tune captcha image: max_front_lines, max_behind_lines

This commit is contained in:
Bogdan Tanase 2013-03-13 12:02:41 +02:00
parent 19142f30e4
commit 2d8d9f3b5f
4 changed files with 8 additions and 1 deletions

View File

@ -39,6 +39,8 @@ class Configuration implements ConfigurationInterface
->scalarNode('whitelist_key')->defaultValue('captcha_whitelist_key')->end()
->scalarNode('humanity')->defaultValue(0)->end()
->scalarNode('distortion')->defaultValue(true)->end()
->scalarNode('max_front_lines')->defaultValue(null)->end()
->scalarNode('max_behind_lines')->defaultValue(null)->end()
->end()
;

View File

@ -95,6 +95,9 @@ class CaptchaGenerator
{
$this->builder->setDistortion($options['distortion']);
$this->builder->setMaxFrontLines($options['max_front_lines']);
$this->builder->setMaxBehindLines($options['max_behind_lines']);
$fingerprint = isset($options['fingerprint']) ? $options['fingerprint'] : null;
$content = $this->builder->build(

View File

@ -136,6 +136,8 @@ You can define the following configuration options globally or on the CaptchaTyp
* **reload**: adds a link to reload the code
* **humanity**: number of extra forms that the user can submit after a correct validation, if set to a value different of 0, only 1 over (1+humanity) forms will contain a CAPTCHA (default=0, i.e each form will contain the CAPTCHA)
* **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)
Example :

View File

@ -18,7 +18,7 @@
],
"require": {
"php": ">=5.3.0",
"gregwar/captcha": "v1.0.1"
"gregwar/captcha": "v1.0.2"
},
"autoload": {
"psr-0": {