From 83aeef1d8602b04716b86790a023bb0211fa25ce Mon Sep 17 00:00:00 2001 From: Preetham Date: Wed, 12 Nov 2014 08:36:35 -0500 Subject: Closing #656 and updating documentation Signed-off-by: Preetham --- system/helpers/captcha_helper.php | 6 +++--- user_guide_src/source/helpers/captcha_helper.rst | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 8c2cfa43e..4398d3191 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -71,7 +71,7 @@ if ( ! function_exists('create_captcha')) 'font_path' => '', 'expiration' => 7200, 'word_length' => 8, - 'font_size' =>16, + 'font_size' =>16, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => array( 'background' => array(255,255,255), @@ -194,13 +194,13 @@ if ( ! function_exists('create_captcha')) $use_font = ($font_path !== '' && file_exists($font_path) && function_exists('imagettftext')); if ($use_font === FALSE) { - $font_size = $font_size>5?5:$font_size; + ($font_size >= 5) && $font_size = 5;; $x = mt_rand(0, $img_width / ($length / 3)); $y = 0; } else { - $font_size = $font_size>30?30:$font_size; + ($font_size > 30) && $font_size = 30; $x = mt_rand(0, $img_width / ($length / 1.5)); $y = $font_size + 2; } diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst index 1b74d08ad..556434a50 100644 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ b/user_guide_src/source/helpers/captcha_helper.rst @@ -33,6 +33,7 @@ Once loaded you can generate a CAPTCHA like this:: 'img_height' => 30, 'expiration' => 7200, 'word_length' => 8, + 'font_size' =>16, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', // White background and border, black text and red grid @@ -59,8 +60,10 @@ Once loaded you can generate a CAPTCHA like this:: in the captcha folder before it will be deleted. The default is two hours. - **word_length** defaults to 8, **pool** defaults to '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +- **font_size** defaults to 16, the native GD font has a size limit. Specify a TRUE TYPE font for bigger sizes. - If any of the **colors** values is missing, it will be replaced by the default. + Adding a Database ----------------- -- cgit v1.2.3-24-g4f1b