Class Captcha

java.lang.Object
org.javalite.activeweb.Captcha

public class Captcha extends Object
This is a simple captcha class, use it to generate a random string and then to create an image of it.
Author:
Igor Polevoy
  • Method Details

    • generateText

      public static String generateText()
      Generates a random alpha-numeric string of eight characters.
      Returns:
      random alpha-numeric string of eight characters.
    • generateImage

      public static byte[] generateImage(String text)
      Generates a PNG image of text 180 pixels wide, 40 pixels high with white background.
      Parameters:
      text - expects string size eight (8) characters.
      Returns:
      byte array that is a PNG image generated with text displayed.