pleroma-elixir-captcha/README.md
2018-07-30 13:49:39 +08:00

2.4 KiB

Captcha

This is a Elixir lib for generating captcha. No dependencies. It drawing captcha image with C code. No ImageMagick, No RMagick.

C code come from: https://github.com/huacnlee/rucaptcha

Installation

If available in Hex, the package can be installed as:

  1. Add captcha to your list of dependencies in mix.exs:
```elixir
def deps do
  [{:captcha, "~> 0.1.0"}]
end
```
  1. Ensure captcha is started before your application:
```elixir
def application do
  [applications: [:captcha]]
end
```

Usage

# allow customize receive timeout, default: 10_000
case Captcha.get() do
  {:ok, text, img_binary } ->
    # save text in session, then send img to client
  {:timeout} ->
    # log some error
end