Documentation ¶
Index ¶
Constants ¶
const ( // Standard width and height of a captcha image. StdWidth = 240 StdHeight = 80 )
const ( MODULE_DIGIT = 10 MODULE_UPPER = 36 MODULE_LOWER = 62 )
These constants are used to set the used character ranges in the captcha image
Variables ¶
This section is empty.
Functions ¶
func AddFont ¶
Add a font to the internal list of available fonts. The name is used to select the font later. The first font you add is selected automatically
func Digit2Rune ¶
func RandomDigits ¶
RandomDigits returns a byte slice of the given length containing pseudorandom numbers in range 0-module. The slice can be used as a captcha solution.
func Rune2Digit ¶
func SelectFont ¶
func SelectFont(name string)
Select a font by the name it was added with AddFont If no font with that name exists, the selected font remains unchanged
func SetCharacterRange ¶
func SetCharacterRange(rang byte)
Set the desired character ranges for the captcha image. For example:
captcha.SetCharacterRange(captcha.MODULE_LOWER)
would use 0-9, A-Z and a-z The default is MODULE_UPPER which means 0-9 and A-Z
Types ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
func LoadFontFromFile ¶
Load a font created by github.com/ZiRo-/captcha/fontgen returns the for usage int AddFont, and an error, if the font can't be loaded.