summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2021-02-04 18:49:53 +0100
committerAndrey Andreev <narf@devilix.net>2021-02-04 18:49:53 +0100
commit324628c27ca82e89d5e3a85034127835d29dd9fc (patch)
treed0689a8d42684123c058c57d08632c53030b1e4b /system/helpers
parentfda124cfd788a9a70cd8608648513271fb859cd9 (diff)
[ci skip] Add 'img_class' option to CAPTCHA helper
Close #5999
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/captcha_helper.php6
1 files changed, 5 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);