diff options
-rw-r--r-- | system/helpers/captcha_helper.php | 6 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 |
2 files changed, 6 insertions, 1 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php index f178903b2..6fce05267 100644 --- a/system/helpers/captcha_helper.php +++ b/system/helpers/captcha_helper.php @@ -69,6 +69,7 @@ if ( ! function_exists('create_captcha')) 'img_width' => '150', 'img_height' => '30', 'img_alt' => 'captcha', + 'img_class' => '', 'font_path' => '', 'font_size' => 16, 'expiration' => 7200, @@ -372,7 +373,10 @@ if ( ! function_exists('create_captcha')) $img_src = 'data:image/png;base64,'.base64_encode($img_src); } - $img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_src.'" style="width: '.$img_width.'px; height: '.$img_height .'px; border: 0;" alt="'.$img_alt.'" />'; + $img_class = trim($img_class); + $img_class = (bool) strlen($img_class) ? 'class="'.$img_class.'" ' : ''; + + $img = '<img '.($img_id === '' ? '' : 'id="'.$img_id.'"').' src="'.$img_src.'" style="width: '.$img_width.'px; height: '.$img_height .'px; border: 0;" '.$img_class.'alt="'.$img_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 afc309436..4e1734694 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -127,6 +127,7 @@ Release Date: Not Released - :doc:`CAPTCHA Helper <helpers/captcha_helper>` changes include: - Added 'img_alt' option with a default value of 'captcha'. + - Added 'img_class' option. - Added ability to generate ``data:image/png;base64`` URIs instead of writing image files to disk. - Updated to always create PNG images instead of JPEG. |