Skip to content

Commit

Permalink
Merge pull request #14 from samirdjelal/main
Browse files Browse the repository at this point in the history
Merge `main` into `dev`
  • Loading branch information
samirdjelal authored May 31, 2023
2 parents b935c19 + d7ce9a4 commit 4e29582
Show file tree
Hide file tree
Showing 25 changed files with 200 additions and 184 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: samirdjelal
custom: ["https://www.paypal.me/samirdjelal", samirdjelal.com]
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "captcha-rs"
version = "0.2.2"
version = "0.2.10"
edition = "2021"
authors = ["Samir Djelal <ssdjelal@gmail.com>"]
readme = "README.md"
Expand All @@ -18,7 +18,7 @@ exclude = [
[dependencies]
log = "0.4.16"
rand = "0.8.5"
image = "0.23.14"
base64 = "0.13.0"
imageproc= "0.22.0"
image = { version = "0.24.5", default-features = false, features = ["jpeg"] }
base64 = "0.21.0"
imageproc= "0.23.0"
rusttype = "0.9.2"
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# captcha-rs

[![Captcha-rs crate](https://img.shields.io/crates/v/captcha-rs.svg)](https://crates.io/crates/captcha-rs)
[![test](https://github.com/samirdjelal/captcha-rs/actions/workflows/test.yml/badge.svg)](https://github.com/samirdjelal/captcha-rs/actions/workflows/test.yml)
[![issues](https://img.shields.io/github/issues/samirdjelal/captcha-rs?color=%23ffc107)](https://github.com/samirdjelal/captcha-rs/issues)
[![Downloads](https://img.shields.io/crates/d/captcha-rs)](https://crates.io/crates/captcha-rs)
[![MIT License](https://img.shields.io/crates/l/captcha-rs)](LICENSE)
[![Captcha-rs documentation](https://img.shields.io/docsrs/captcha-rs)](https://docs.rs/captcha-rs)
[![dependency status](https://deps.rs/repo/github/samirdjelal/captcha-rs/status.svg)](https://deps.rs/repo/github/samirdjelal/captcha-rs)
[![Captcha-rs crate](https://img.shields.io/crates/v/captcha-rs.svg?style=flat&logo=appveyor)](https://crates.io/crates/captcha-rs)
[![test](https://github.com/samirdjelal/captcha-rs/actions/workflows/test.yml/badge.svg?style=flat&logo=appveyor)](https://github.com/samirdjelal/captcha-rs/actions/workflows/test.yml)
[![issues](https://img.shields.io/github/issues/samirdjelal/captcha-rs?color=%23ffc107&style=flat&logo=appveyor)](https://github.com/samirdjelal/captcha-rs/issues)
[![Downloads](https://img.shields.io/crates/d/captcha-rs?style=flat&logo=appveyor)](https://crates.io/crates/captcha-rs)
[![MIT License](https://img.shields.io/crates/l/captcha-rs?style=flat&logo=appveyor)](LICENSE)
[![Captcha-rs documentation](https://img.shields.io/docsrs/captcha-rs?style=flat&logo=appveyor)](https://docs.rs/captcha-rs)
[![dependency status](https://deps.rs/repo/github/samirdjelal/captcha-rs/status.svg?style=flat&logo=appveyor)](https://deps.rs/repo/github/samirdjelal/captcha-rs)

**captcha-rs** is a library that generate verification images dynamically.

Expand All @@ -16,13 +16,29 @@ Example pictures are as follows:
--- | --- | ---
![img-dark-1.png](images/img-dark-1.png) | ![img-dark-2.png](images/img-dark-2.png) | ![img-dark-3.png](images/img-dark-3.png)

### Using complexity method

Complexity | Light Mode / Noise Filter | Dark Mode / Noise Filter
--- |--------------------------------------------------| ---
Level 1 | ![img-light](images/img-light-complexity-1.png) | ![img-dark](images/img-dark-complexity-1.png)
Level 2 | ![img-light](images/img-light-complexity-2.png) | ![img-dark](images/img-dark-complexity-2.png)
Level 3 | ![img-light](images/img-light-complexity-3.png) | ![img-dark](images/img-dark-complexity-3.png)
Level 4 | ![img-light](images/img-light-complexity-4.png) | ![img-dark](images/img-dark-complexity-4.png)
Level 5 | ![img-light](images/img-light-complexity-5.png) | ![img-dark](images/img-dark-complexity-5.png)
Level 6 | ![img-light](images/img-light-complexity-6.png) | ![img-dark](images/img-dark-complexity-6.png)
Level 7 | ![img-light](images/img-light-complexity-7.png) | ![img-dark](images/img-dark-complexity-7.png)
Level 8 | ![img-light](images/img-light-complexity-8.png) | ![img-dark](images/img-dark-complexity-8.png)
Level 9 | ![img-light](images/img-light-complexity-9.png) | ![img-dark](images/img-dark-complexity-9.png)
Level 10 | ![img-light](images/img-light-complexity-10.png) | ![img-dark](images/img-dark-complexity-10.png)


## Example

Add the following dependency to the Cargo.toml file:

```toml
[dependencies]
captcha-rs = "0.2.2"
captcha-rs = "0.2.10"
```

And then get started in your `main.rs`:
Expand All @@ -38,10 +54,11 @@ fn main() {
.height(40)
.dark_mode(false)
.complexity(1) // min: 1, max: 10
.compression(40) // min: 1, max: 99
.build();

println!("text: {}", captcha.text);
println!("base_img: {}", captcha.base_img);
println!("base_img: {}", captcha.to_base64());

}
```
Expand All @@ -50,13 +67,13 @@ fn main() {

```bash
# Dev
$ cargo run
💲 cargo run

# Build
$ cargo build
💲 cargo build

# Test
$ cargo test -- --nocapture
💲 cargo test -- --nocapture
```

## License
Expand Down
Binary file added images/img-dark-complexity-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-dark-complexity-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/img-light-complexity-9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4e29582

Please sign in to comment.