diff options
author | Andrey Andreev <narf@devilix.net> | 2014-12-05 18:23:11 +0100 |
---|---|---|
committer | Andrey Andreev <narf@devilix.net> | 2014-12-05 18:23:11 +0100 |
commit | 3c0427e7dd11380692f9898d7cc04ba1b5a8491b (patch) | |
tree | 0350ade3d4aa3b4bf64d7e898f8d49dd6239df89 | |
parent | 82358c1f2ce5117a21e90f6ec96400535c5f4eed (diff) | |
parent | 6157e52f1988c3640082fe6fd323ebbc07887259 (diff) |
Merge pull request #3393 from preems/develop
Added img_id to capcha helper
Close #51
-rw-r--r-- | system/helpers/captcha_helper.php | 3 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/helpers/captcha_helper.rst | 4 |
3 files changed, 6 insertions, 2 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index 2ffa86d97..5fa61e051 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -72,6 +72,7 @@ if ( ! function_exists('create_captcha')) 'expiration' => 7200, 'word_length' => 8, 'font_size' => 16, + 'img_id' => '', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', 'colors' => array( 'background' => array(255,255,255), @@ -244,7 +245,7 @@ if ( ! function_exists('create_captcha')) return FALSE; } - $img = '<img src="'.$img_url.$img_filename.'" style="width: '.$img_width.'; height: '.$img_height .'; border: 0;" alt=" " />'; + $img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_url.$img_filename.'" style="width: '.$img_width.'; height: '.$img_height .'; border: 0;" alt=" " />'; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index ff319b8d2..431016d6a 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -136,6 +136,7 @@ Release Date: Not Released - 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. + - Added **img_id** option to set id attribute of captcha image. - :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 3cf51330b..4aacafd49 100644 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ b/user_guide_src/source/helpers/captcha_helper.rst @@ -34,6 +34,7 @@ Once loaded you can generate a CAPTCHA like this:: 'expiration' => 7200, 'word_length' => 8, 'font_size' => 16, + 'img_id' => 'Imageid', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', // White background and border, black text and red grid @@ -60,7 +61,8 @@ 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. +- **font_size** defaults to 16, the native GD font has a size limit. Specify a "true type" font for bigger sizes. +- The **img_id** will be set as the "id" of the captcha image. - If any of the **colors** values is missing, it will be replaced by the default. Adding a Database |