summaryrefslogtreecommitdiffstats
path: root/system/helpers/captcha_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/captcha_helper.php')
-rw-r--r--system/helpers/captcha_helper.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/system/helpers/captcha_helper.php b/system/helpers/captcha_helper.php
index 5d023b28c..7cdc0aff2 100644
--- a/system/helpers/captcha_helper.php
+++ b/system/helpers/captcha_helper.php
@@ -2,11 +2,11 @@
/**
* CodeIgniter
*
- * An open source application development framework for PHP 5.2.4 or newer
+ * An open source application development framework for PHP
*
* This content is released under the MIT License (MIT)
*
- * Copyright (c) 2014, British Columbia Institute of Technology
+ * Copyright (c) 2014 - 2015, British Columbia Institute of Technology
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,7 @@
* @package CodeIgniter
* @author EllisLab Dev Team
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/)
- * @copyright Copyright (c) 2014, British Columbia Institute of Technology (http://bcit.ca/)
+ * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/)
* @license http://opensource.org/licenses/MIT MIT License
* @link http://codeigniter.com
* @since Version 1.0.0
@@ -71,6 +71,8 @@ if ( ! function_exists('create_captcha'))
'font_path' => '',
'expiration' => 7200,
'word_length' => 8,
+ 'font_size' => 16,
+ 'img_id' => '',
'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
'colors' => array(
'background' => array(255,255,255),
@@ -193,13 +195,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;
}
@@ -243,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);