go-captcha-assets

command module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

Captcha Assets

Go Captcha presets some default embedded resources and stores them in the Go file format. In addition, you can also configure the captcha according to your own needs.

Install

$ go get -u github.com/wenlng/go-captcha-assets@latest
Chinese Text Assets
import "github.com/wenlng/go-captcha-assets/bindata/chars"

func Demo() {
    chars := chars.GetChineseChars()
}
Alpha Text Assets
import "github.com/wenlng/go-captcha-assets/bindata/chars"

func Demo() {
    chars := chars.GetAlphaChars()
}
Font Assets
import "github.com/wenlng/go-captcha-assets/resources/fonts/fzshengsksjw"
import "github.com/wenlng/go-captcha-assets/resources/fonts/yrdzst"

func Demo() {
    fonts, err := fzshengsksjw.GetFont()
    if err != nil {
        log.Fatalln(err)
    }
    
    // OR
    
    fonts, err := yrdzst.GetFont()
    if err != nil {
        log.Fatalln(err)
    }
}
Image Assets
import "github.com/wenlng/go-captcha-assets/resources/images"

func Demo() {
    imgs, err := images.GetImages()
    if err != nil {
        log.Fatalln(err)
    }
}
Shape Assets
import "github.com/wenlng/go-captcha-assets/resources/shapes"

func Demo() {
    shapeMaps, err := shapes.GetShapes()
    if err != nil {
        log.Fatalln(err)
    }
}
Thumbnail Assets
import "github.com/wenlng/go-captcha-assets/resources/thumb"

func Demo() {
    imgs, err := thumb.GetImages()
    if err != nil {
        log.Fatalln(err)
    }
}
Tile Assets
import "github.com/wenlng/go-captcha-assets/resources/tiles"

func Demo() {
    graphs, err := tiles.GetTiles()
    if err != nil {
        log.Fatalln(err)
    }
    
    // slide
    var newGraphs = make([]*slide.GraphImage, 0, len(graphs))
    for i := 0; i < len(graphs); i++ {
        graph := graphs[i]
        newGraphs = append(newGraphs, &slide.GraphImage{
            OverlayImage: graph.OverlayImage,
            MaskImage:    graph.MaskImage,
            ShadowImage:  graph.ShadowImage,
        })
    }
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
bindata
fonts/fzshengsksjw
Code generated for package fzshengsksjw by go-bindata DO NOT EDIT.
Code generated for package fzshengsksjw by go-bindata DO NOT EDIT.
fonts/yrdzst
Code generated for package yrdzst by go-bindata DO NOT EDIT.
Code generated for package yrdzst by go-bindata DO NOT EDIT.
images
Code generated for package images by go-bindata DO NOT EDIT.
Code generated for package images by go-bindata DO NOT EDIT.
shapes
Code generated for package shapes by go-bindata DO NOT EDIT.
Code generated for package shapes by go-bindata DO NOT EDIT.
thumbs
Code generated for package thumbs by go-bindata DO NOT EDIT.
Code generated for package thumbs by go-bindata DO NOT EDIT.
tiles
Code generated for package tiles by go-bindata DO NOT EDIT.
Code generated for package tiles by go-bindata DO NOT EDIT.
resources

Jump to

Keyboard shortcuts

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