Class MGL_CaptchaImage

java.lang.Object
tech.mgl.core.utils.captcha.MGL_CaptchaImage

public class MGL_CaptchaImage extends Object
验证码工具类,生成验证码及验证码图片都在一起的工具类 not use yet ClassName: VerifyCode
Author:
hotpot ...
  • Method Details

    • getInstance

      public static MGL_CaptchaImage getInstance()
      获取唯一实力
      Returns:
    • createImage

      public BufferedImage createImage(String securityCode)
      生成验证码图片,随机背景,随机验证码颜色的验证码图片
      Parameters:
      securityCode - 验证码字符
      Returns:
      BufferedImage 图片
    • getImage

      public ByteArrayInputStream getImage(String securityCode) throws Exception
      返回验证码图片的流格式
      Parameters:
      securityCode - 验证码
      Returns:
      ByteArrayInputStream 图片流
      Throws:
      Exception
    • convertImageToStream

      public ByteArrayInputStream convertImageToStream(BufferedImage image) throws Exception
      将BufferedImage转换成ByteArrayInputStream
      Parameters:
      image - 图片
      Returns:
      ByteArrayInputStream 流
      Throws:
      Exception
    • getImageWithGif

      public ByteArrayInputStream getImageWithGif(String code)
      获取带动画效果的验证码的带参数的主方法
      Parameters:
      code -
      Returns:
    • getImageWithGif

      public ByteArrayInputStream getImageWithGif()
      获取带动画效果的验证码的不带参数的方法,默认自动生成验证码
      Returns:
    • getImageWithGifAsOutputStream

      public ByteArrayOutputStream getImageWithGifAsOutputStream(String code)
      获取流
      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

      public String getVerifyCode()
    • setVerifyCode

      public void setVerifyCode(String verifyCode)