From 324628c27ca82e89d5e3a85034127835d29dd9fc Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Thu, 4 Feb 2021 19:49:53 +0200 Subject: [ci skip] Add 'img_class' option to CAPTCHA helper Close #5999 --- system/helpers/captcha_helper.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'system') 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_alt.''; + $img_class = trim($img_class); + $img_class = (bool) strlen($img_class) ? 'class="'.$img_class.'" ' : ''; + + $img = ''; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img, 'filename' => $img_filename); -- cgit v1.2.3-24-g4f1b