Skip to content

Commit

Permalink
Add usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
pchchv committed May 30, 2023
1 parent 7755d0a commit 6b8ff3a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@

This package uses embed package from Go 1.16.

## Usage

```Go
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](examples/captcha.png)

Expand Down

0 comments on commit 6b8ff3a

Please sign in to comment.