Package tech.mgl.core.utils.captcha
Class MGL_CaptchaImage
java.lang.Object
tech.mgl.core.utils.captcha.MGL_CaptchaImage
验证码工具类,生成验证码及验证码图片都在一起的工具类 not use yet
ClassName: VerifyCode
- Author:
- hotpot ...
-
Method Summary
Modifier and TypeMethodDescription将BufferedImage转换成ByteArrayInputStreamcreateImage(String securityCode) 生成验证码图片,随机背景,随机验证码颜色的验证码图片返回验证码图片的流格式获取gif动画的验证码获取带动画效果的验证码的不带参数的方法,默认自动生成验证码getImageWithGif(String code) 获取带动画效果的验证码的带参数的主方法获取流static MGL_CaptchaImage获取唯一实力voidsetVerifyCode(String verifyCode)
-
Method Details
-
getInstance
获取唯一实力- Returns:
-
createImage
生成验证码图片,随机背景,随机验证码颜色的验证码图片- Parameters:
securityCode- 验证码字符- Returns:
- BufferedImage 图片
-
getImage
返回验证码图片的流格式- Parameters:
securityCode- 验证码- Returns:
- ByteArrayInputStream 图片流
- Throws:
Exception
-
convertImageToStream
将BufferedImage转换成ByteArrayInputStream- Parameters:
image- 图片- Returns:
- ByteArrayInputStream 流
- Throws:
Exception
-
getImageWithGif
获取带动画效果的验证码的带参数的主方法- Parameters:
code-- Returns:
-
getImageWithGif
获取带动画效果的验证码的不带参数的方法,默认自动生成验证码- Returns:
-
getImageWithGifAsOutputStream
获取流- Parameters:
code-- Returns:
-
getImageToGif
public BufferedImage getImageToGif(Color bgcolor, Color linecolor, Color[] fontcolor, String str, Font[] font, int flag) 获取gif动画的验证码- Parameters:
bgcolor- 背景颜色linecolor- 线条障碍物的颜色fontcolor- 字体颜色str- 验证码字母font- 字体flag-- Returns:
-
getVerifyCode
-
setVerifyCode
-