From b085af6e0078d216d048422bb5816ce06ae1bd21 Mon Sep 17 00:00:00 2001 From: lackovic10 Date: Wed, 25 Sep 2013 20:53:52 +0200 Subject: [PATCH 1/6] composer.json - updated to use a gregwar/captcha fork (chesscom) --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7b75481..7086a91 100644 --- a/composer.json +++ b/composer.json @@ -16,9 +16,15 @@ "email": "jeremy.j.livingston@gmail.com" } ], + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:ChessCom/Captcha" + } + ], "require": { "php": ">=5.3.0", - "gregwar/captcha": "v1.0.8" + "gregwar/captcha": "dev-master" }, "autoload": { "psr-0": { From 4f46a609ba03876a500e6d8fb67f84d49fee4d8e Mon Sep 17 00:00:00 2001 From: lackovic10 Date: Thu, 26 Sep 2013 17:28:48 +0200 Subject: [PATCH 2/6] Revert "composer.json - updated to use a gregwar/captcha fork (chesscom)" This reverts commit b085af6e0078d216d048422bb5816ce06ae1bd21. --- composer.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 7086a91..7b75481 100644 --- a/composer.json +++ b/composer.json @@ -16,15 +16,9 @@ "email": "jeremy.j.livingston@gmail.com" } ], - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:ChessCom/Captcha" - } - ], "require": { "php": ">=5.3.0", - "gregwar/captcha": "dev-master" + "gregwar/captcha": "v1.0.8" }, "autoload": { "psr-0": { From a16743a23023e24039a66a4ffffee7709c15e364 Mon Sep 17 00:00:00 2001 From: lackovic10 Date: Thu, 26 Sep 2013 20:38:39 +0200 Subject: [PATCH 3/6] added background_images to configuration --- DependencyInjection/Configuration.php | 1 + Generator/CaptchaGenerator.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 9f9fbd5..1ffc7e2 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -44,6 +44,7 @@ class Configuration implements ConfigurationInterface ->scalarNode('interpolation')->defaultValue(true)->end() ->arrayNode('text_color')->prototype('scalar')->end()->end() ->arrayNode('background_color')->prototype('scalar')->end()->end() + ->arrayNode('background_images')->prototype('scalar')->end()->end() ->end() ; diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 60db59b..e997c67 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -120,6 +120,9 @@ class CaptchaGenerator $fingerprint = isset($options['fingerprint']) ? $options['fingerprint'] : null; + // set background images + $this->builder->setBackgroundImages($options['background_images']); + $content = $this->builder->build( $options['width'], $options['height'], From 3ad62e4d0d685f00cd4afcbe93ee051775376e0c Mon Sep 17 00:00:00 2001 From: lackovic10 Date: Thu, 26 Sep 2013 21:10:02 +0200 Subject: [PATCH 4/6] added ignore_all_effects to configuration --- DependencyInjection/Configuration.php | 1 + Generator/CaptchaGenerator.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 1ffc7e2..0fd6466 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -45,6 +45,7 @@ class Configuration implements ConfigurationInterface ->arrayNode('text_color')->prototype('scalar')->end()->end() ->arrayNode('background_color')->prototype('scalar')->end()->end() ->arrayNode('background_images')->prototype('scalar')->end()->end() + ->scalarNode('ignore_all_effects')->defaultValue(false)->end() ->end() ; diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index e997c67..9e9e302 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -123,6 +123,9 @@ class CaptchaGenerator // set background images $this->builder->setBackgroundImages($options['background_images']); + // set ignore all effects + $this->builder->setIgnoreAllEffects($options['ignore_all_effects']); + $content = $this->builder->build( $options['width'], $options['height'], From 34a84af209a3d89003149071a27415459a63823d Mon Sep 17 00:00:00 2001 From: lackovic10 Date: Thu, 26 Sep 2013 21:22:02 +0200 Subject: [PATCH 5/6] README.md - updated docs, added background images and ignore all effects descriptions --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9a81582..e71612e 100644 --- a/README.md +++ b/README.md @@ -139,7 +139,9 @@ You can define the following configuration options globally or on the CaptchaTyp * **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 +* **background_images**: Sets custom user defined images as the captcha background (1 image is selected randomly). It is recommended to turn off all the effects on the image (ignore_all_effects). The full paths to the images must be passed. * **interpolation**: enable or disable the interpolation on the captcha +* **ignore_all_effects**: Recommended to use when passing background images, will disable all image effects. Example : From 232168d4087a4782613066909b4101d857a6d2d0 Mon Sep 17 00:00:00 2001 From: Ivan Lackovic Date: Tue, 19 May 2015 20:20:14 +0200 Subject: [PATCH 6/6] remove comments --- Generator/CaptchaGenerator.php | 3 --- README.md | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/Generator/CaptchaGenerator.php b/Generator/CaptchaGenerator.php index 25b4f71..3f192f5 100644 --- a/Generator/CaptchaGenerator.php +++ b/Generator/CaptchaGenerator.php @@ -124,10 +124,7 @@ class CaptchaGenerator $fingerprint = isset($options['fingerprint']) ? $options['fingerprint'] : null; - // set background images $this->builder->setBackgroundImages($options['background_images']); - - // set ignore all effects $this->builder->setIgnoreAllEffects($options['ignore_all_effects']); $content = $this->builder->build( diff --git a/README.md b/README.md index 67c0cfe..dfe42ac 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ 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 * **background_images**: Sets custom user defined images as the captcha background (1 image is selected randomly). It is recommended to turn off all the effects on the image (ignore_all_effects). The full paths to the images must be passed. * **interpolation**: enable or disable the interpolation on the captcha -* **ignore_all_effects**: Recommended to use when passing background images, will disable all image effects. +* **ignore_all_effects**: Recommended to use when setting background images, will disable all image effects. Example :