Update env_logger and image.

Update `env_logger` to 0.9.0 and `image` to 0.24.0.
This commit is contained in:
Rasmus Kaj 2022-02-06 19:31:59 +01:00
parent 640dc328eb
commit c4c3d92af8
2 changed files with 6 additions and 5 deletions

View File

@ -13,9 +13,9 @@ ructe = { version = "0.13.4", features = ["sass", "warp03"] }
brotli = "3.3.0"
chrono = "0.4.0" # Must match version used by diesel
dotenv = "0.15"
env_logger = "0.8.1"
env_logger = "0.9.0"
flate2 = "1.0.14"
image = "0.23.11"
image = "0.24.0"
medallion = "2.3.1"
kamadak-exif = "0.5.0"
libc = "0.2.68"

View File

@ -1,7 +1,7 @@
use crate::models::Photo;
use crate::myexif::ExifData;
use image::imageops::FilterType;
use image::{self, GenericImageView, ImageError, ImageFormat};
use image::{self, ImageError, ImageFormat};
use log::{debug, info, warn};
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
@ -133,7 +133,7 @@ pub async fn get_scaled_jpeg(
use std::fs::File;
use std::io::BufReader;
let file = BufReader::new(File::open(path)?);
let mut decoder = image::jpeg::JpegDecoder::new(file)?;
let mut decoder = image::codecs::jpeg::JpegDecoder::new(file)?;
decoder.scale(size as u16, size as u16)?;
image::DynamicImage::from_decoder(decoder)?
} else {
@ -160,7 +160,8 @@ pub async fn get_scaled_jpeg(
}
};
let mut buf = Vec::new();
img.write_to(&mut buf, ImageFormat::Jpeg)?;
use std::io::Cursor;
img.write_to(&mut Cursor::new(&mut buf), ImageFormat::Jpeg)?;
Ok(buf)
})
.await?