summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-11-13 12:58:16 +0100
committerAndrey Andreev <narf@devilix.net>2014-11-13 12:58:16 +0100
commit90671c02d6bb871da6b03c870fb27349885b0b50 (patch)
treec818785c97771a6858fe7b5817dd3b0f4d4a889a
parent2ed757146d04901f39135c68fe090d6d7c4cacb0 (diff)
parentbfa16449fe533ece12064074204beffcc5b39163 (diff)
Merge pull request #3325 from preems/develop
closing #656 add font_size in create_captcha()
-rw-r--r--system/helpers/captcha_helper.php5
-rw-r--r--user_guide_src/source/changelog.rst1
-rw-r--r--user_guide_src/source/helpers/captcha_helper.rst2
3 files changed, 6 insertions, 2 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 5d023b28c..2ffa86d97 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 > 5) && $font_size = 5;
$x = mt_rand(0, $img_width / ($length / 3));
$y = 0;
}
else
{
- $font_size = 16;
+ ($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/changelog.rst b/user_guide_src/source/changelog.rst
index 25f6f2cea..242881c99 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -133,6 +133,7 @@ Release Date: Not Released
- Added *colors* configuration to allow customization for the *background*, *border*, *text* and *grid* colors.
- Added *filename* to the returned array elements.
- Updated to use `imagepng()` in case that `imagejpeg()` isn't available.
+ - Added **font_size** option to allow customization of font size.
- :doc:`Text Helper <helpers/text_helper>` changes include:
diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst
index 1b74d08ad..3cf51330b 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,6 +60,7 @@ 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