easyCaptcha

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

README

easy-captcha

example

png png gif gif gif

Install

To use easy-captcha in your Go project, you can import it using the following command:

 go get github.com/wwwwwbr/easy-captcha

Usage

To use the timezone conversion functions, first import this package:

import (
    easyCaptcha "github.com/wwwwwbr/easy-captcha"
)

Then, call the function

captcha := easyCaptcha.NewGifCaptcha(120, 60, 4) // gif
//captcha := easyCaptcha.NewSimpleCaptcha(120, 60, 4) // simple
//captcha := easyCaptcha.exampleChinese(120, 60, 4) // chinese
//captcha := easyCaptcha.NewCalculationCaptcha(120, 60, 3) // calculate

_ = captcha.SaveFile(GifPath)

text := captcha.Text()
fmt.Println(text)

base64, _ := captcha.Base64()
fmt.Println(base64)
	

Documentation

Index

Constants

View Source
const (
	// 去除容易混淆的字母数字
	Seed_No_Similar_Alphanumeric = "abcdefghjkmnprstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ2345678"
	// 字母(a-zA-Z) + 数字(0-9)
	Seed_Alphanumeric = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
	// 字母(a-zA-Z)
	Seed_Alphabetic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	// 数字(0-9)
	Seed_Numeric = "0123456789"
)

Variables

View Source
var (
	ACTIONJ  = captchaFont{/* contains filtered or unexported fields */}
	EPI_LOG  = captchaFont{/* contains filtered or unexported fields */}
	FRESNEL  = captchaFont{/* contains filtered or unexported fields */}
	HEADACHE = captchaFont{/* contains filtered or unexported fields */}
	LEXO     = captchaFont{/* contains filtered or unexported fields */}
	PREFIX   = captchaFont{/* contains filtered or unexported fields */}
	PROGBOT  = captchaFont{/* contains filtered or unexported fields */}
	RANSOM   = captchaFont{/* contains filtered or unexported fields */}
	ROBOT    = captchaFont{/* contains filtered or unexported fields */}
	SCANDAL  = captchaFont{/* contains filtered or unexported fields */}
)
View Source
var HanZiLib = []rune("的是不了在人有我他这个们中国大上为和地到以说时要就出会可也用学生很好看语文字又都从自前后方向如果得而与本去来之发也些里思想情况感觉间新旧长短高低白红黄绿蓝黑少多每次定总般")
View Source
var SourceFS embed.FS

Functions

func NewCaptchaFont

func NewCaptchaFont(fontPath string) captchaFont

Types

type Captcha

type Captcha interface {
	SetLineNum(int)
	SetBackgroundColor(color.Color)
	SetSeed(seed string)
	SetFont(captchaFont)

	Text() string
	GetBytes() ([]byte, error)
	SaveFile(filename string) error
	Base64() (string, error)
	// contains filtered or unexported methods
}

func NewCalculationCaptcha

func NewCalculationCaptcha(width, height, size int) Captcha

func NewChineseCaptcha

func NewChineseCaptcha(width, height, size int, fontPath string) Captcha

func NewGifCaptcha

func NewGifCaptcha(width, height, size int) Captcha

func NewSimpleCaptcha

func NewSimpleCaptcha(width, height, size int) Captcha

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL