Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
robatipoor committed Sep 24, 2020
1 parent b940944 commit 70b49b7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -13,7 +13,7 @@ repository = "https://github.com/daniel-e/captcha"
edition = "2018"

[dependencies]
image = "0.23.8"
image = "0.23.9"
png = "0.16.7"
rand = "0.7.3"
serde_json = "1.0.57"
Expand Down
2 changes: 1 addition & 1 deletion src/images/mod.rs
Expand Up @@ -80,7 +80,7 @@ impl Image {
self.img.save(p)
}

pub fn save_(&self, path: &Path, format: ImageFormat) -> ImageResult<()> {
pub fn save_with_format(&self, path: &Path, format: ImageFormat) -> ImageResult<()> {
self.img.save_with_format(path, format)
}

Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Expand Up @@ -49,7 +49,7 @@

extern crate base64;
extern crate image;
extern crate lodepng;
extern crate png;
extern crate rand;
extern crate serde_json;

Expand Down Expand Up @@ -168,6 +168,7 @@ impl Captcha {
if let Some((c, i)) = self.random_char_as_image() {
let x = self.text_area.right;
let y = (self.text_area.bottom + self.text_area.top) / 2 - i.height() / 2;

self.img.add_image(x, y, &i);

self.text_area.top = min(self.text_area.top, y);
Expand Down

0 comments on commit 70b49b7

Please sign in to comment.