Properly resize images, bump library generation to match.
This commit is contained in:
parent
b801954599
commit
43974b7406
@ -16,7 +16,7 @@ use rocksdb::IteratorMode;
|
|||||||
use rocksdb::DB;
|
use rocksdb::DB;
|
||||||
|
|
||||||
// Used to ensure DB is invalidated after schema changes.
|
// Used to ensure DB is invalidated after schema changes.
|
||||||
const LIBRARY_GENERATION: &'static str = "1";
|
const LIBRARY_GENERATION: &'static str = "2";
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Library {
|
pub struct Library {
|
||||||
@ -34,6 +34,7 @@ impl Library {
|
|||||||
cache_db,
|
cache_db,
|
||||||
root,
|
root,
|
||||||
};
|
};
|
||||||
|
lib.clean_db()?;
|
||||||
if !lib.originals_dir.exists() {
|
if !lib.originals_dir.exists() {
|
||||||
info!(
|
info!(
|
||||||
"create originals dir {}",
|
"create originals dir {}",
|
||||||
@ -163,7 +164,8 @@ impl Library {
|
|||||||
.decode()
|
.decode()
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
||||||
// TODO (wathiede) resize..fill
|
// TODO (wathiede) resize..fill
|
||||||
let img = orig_img.resize(w, h, image::imageops::FilterType::CatmullRom);
|
let img =
|
||||||
|
orig_img.resize_to_fill(w, h, image::imageops::FilterType::CatmullRom);
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
img.write_to(&mut buf, image::ImageFormat::Jpeg)
|
img.write_to(&mut buf, image::ImageFormat::Jpeg)
|
||||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))?;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user