Skip to content

Latest commit

 

History

History
34 lines (23 loc) · 937 Bytes

README.md

File metadata and controls

34 lines (23 loc) · 937 Bytes

captcha provides an simple, unopinionated API for captcha generation

goreference Go Report Card

Compatibility

This package uses embed package from Go 1.16.

Usage

import "github.com/pchchv/captcha"

func handle(w http.ResponseWriter, r *http.Request) {
	// create a captcha of 150x50px
	data, _ := captcha.New(150, 50)

	// session come from other library such as gorilla/sessions
	session.Values["captcha"] = data.Text
	session.Save(r, w)
	// send image data to client
	data.WriteImage(w)
}

Sample image

image

documentation | example | font example