From 692e7967d48c67f28f52da6051e4715a6d891b5a Mon Sep 17 00:00:00 2001 From: Preetham Date: Tue, 11 Nov 2014 22:49:43 -0500 Subject: Fix #656 add font_size in create_captcha() --- system/helpers/captcha_helper.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system/helpers/captcha_helper.php') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 5d023b28c..8c2cfa43e 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -71,6 +71,7 @@ if ( ! function_exists('create_captcha')) 'font_path' => '', 'expiration' => 7200, 'word_length' => 8, + 'font_size' =>16, 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => array( 'background' => array(255,255,255), @@ -193,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 = 5; + $font_size = $font_size>5?5:$font_size; $x = mt_rand(0, $img_width / ($length / 3)); $y = 0; } else { - $font_size = 16; + $font_size = $font_size>30?30:$font_size; $x = mt_rand(0, $img_width / ($length / 1.5)); $y = $font_size + 2; } -- cgit v1.2.3-24-g4f1b 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 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers/captcha_helper.php') 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; } -- cgit v1.2.3-24-g4f1b From bfa16449fe533ece12064074204beffcc5b39163 Mon Sep 17 00:00:00 2001 From: Preetham Date: Wed, 12 Nov 2014 10:26:24 -0500 Subject: removed additional tabs and semicolon Signed-off-by: Preetham --- system/helpers/captcha_helper.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'system/helpers/captcha_helper.php') diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 4398d3191..2ffa86d97 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,7 +194,7 @@ if ( ! function_exists('create_captcha')) $use_font = ($font_path !== '' && file_exists($font_path) && function_exists('imagettftext')); if ($use_font === FALSE) { - ($font_size >= 5) && $font_size = 5;; + ($font_size > 5) && $font_size = 5; $x = mt_rand(0, $img_width / ($length / 3)); $y = 0; } -- cgit v1.2.3-24-g4f1b