daniel-e / captcha

CAPTCHA library written in Rust.
MIT License
98 stars 18 forks source link

Works as designed, but... #2

Closed 4parsleythelion closed 3 years ago

4parsleythelion commented 4 years ago

Hi Sir,

I use your Captcha crate in Rocket, and I producing images, great. Now as I'm a novice at Rust I can't work out how to get the string that the image is displaying so I can compare it. Sorry to ask such a stupid question but I'm a little stuck.

The crate is working great and the documents got me this far.

Thank you for your time and effort,

Ashley

PeterUlb commented 4 years ago

https://docs.rs/captcha/0.0.7/captcha/struct.Captcha.html#method.chars

Just call it on your captcha instance.

4parsleythelion commented 4 years ago

Peter,

Thank you for the reply, and I used the following, which works like a champ:

let mut cap = Captcha::new(); cap.add_chars(5); cap.apply_filter(Noise::new(0.2)); cap.apply_filter(Wave::new(2.0, 20.0)); cap.view(220, 120); cap.save(Path::new("./static/captcha.png")).expect("save failed"); let capkey = Captcha::chars_as_string(&cap);

Thank you once again.

Ashley

From: PeterUlb notifications@github.com Sent: Friday, February 21, 2020 17:03 To: daniel-e/captcha captcha@noreply.github.com Cc: Ashley S. Buss ashley@elfbuiltsoftware.com; Author author@noreply.github.com Subject: Re: [daniel-e/captcha] Works as designed, but... (#2)

https://docs.rs/captcha/0.0.7/captcha/struct.Captcha.html#method.chars

Just call it on your captcha instance.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/daniel-e/captcha/issues/2?email_source=notifications&email_token=ANAZXIVRREZFXJPRVEEY7ZTREBTSTA5CNFSM4KGIRBWKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMUPNKQ#issuecomment-589887146, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANAZXIQI7NM3I6CCYVXYD2LREBTSTANCNFSM4KGIRBWA.

daniel-e commented 3 years ago

Just added an example to the example files.