diff options
author | xue <> | 2007-08-30 16:18:16 +0000 |
---|---|---|
committer | xue <> | 2007-08-30 16:18:16 +0000 |
commit | 827821796cc29b5eebb89e3ec375c7e8e9420418 (patch) | |
tree | 89a4a9d1d2a507afdac4908b7e15205a7efcb020 /framework/Web/UI/WebControls/assets | |
parent | 41d70fd8194ddcb4a4ce065fb265c0e0f278a0c8 (diff) |
Added text shadow option.
Diffstat (limited to 'framework/Web/UI/WebControls/assets')
-rw-r--r-- | framework/Web/UI/WebControls/assets/captcha.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/framework/Web/UI/WebControls/assets/captcha.php b/framework/Web/UI/WebControls/assets/captcha.php index 26ed44f4..48c39cb2 100644 --- a/framework/Web/UI/WebControls/assets/captcha.php +++ b/framework/Web/UI/WebControls/assets/captcha.php @@ -15,6 +15,7 @@ define('THEME_NOISY_BACKGROUND',0x0002); define('THEME_HAS_GRID',0x0004);
define('THEME_HAS_SCRIBBLE',0x0008);
define('THEME_MORPH_BACKGROUND',0x0010);
+define('THEME_SHADOWED_TEXT',0x0020);
require_once(dirname(__FILE__).'/captcha_key.php');
@@ -102,10 +103,17 @@ function displayToken($token,$fontSize,$theme) if(function_exists('imagefilter'))
imagefilter($image,IMG_FILTER_GAUSSIAN_BLUR);
+ $hasShadow=($theme&THEME_SHADOWED_TEXT);
for($i=0;$i<$length;$i++)
{
$color=imagecolorallocate($image,rand(150,220),rand(150,220),rand(150,220));
- imagettftext($image,rand($fontWidth-10,$fontWidth),rand(-30, 30),$padding+$i*$fontWidth,rand($fontHeight-15,$fontHeight-10),$color,$font,$token[$i]);
+ $size=rand($fontWidth-10,$fontWidth);
+ $angle=rand(-30,30);
+ $x=$padding+$i*$fontWidth;
+ $y=rand($fontHeight-15,$fontHeight-10);
+ imagettftext($image,$size,$angle,$x,$y,$color,$font,$token[$i]);
+ if($hasShadow)
+ imagettftext($image,$size,$angle,$x+2,$y+2,$color,$font,$token[$i]);
imagecolordeallocate($image,$color);
}
|