diff options
author | Julian T <julian@jtle.dk> | 2021-07-26 23:50:07 +0200 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-07-26 23:50:40 +0200 |
commit | d7244c2cc7b8f62f2f42cca7f3dece89c30bf105 (patch) | |
tree | 8b7bae761350bc05e1db0cc338daffc947a8e745 /src/picture.rs | |
parent | 0ddf24fa0be620fc10cc07247b2c738b32943042 (diff) |
Add scaled image to page
Diffstat (limited to 'src/picture.rs')
-rw-r--r-- | src/picture.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/picture.rs b/src/picture.rs index 76a33df..3f78f90 100644 --- a/src/picture.rs +++ b/src/picture.rs @@ -11,6 +11,7 @@ use crate::context::Context; #[derive(Debug)] pub enum LoadError { + PathError, Io(io::Error), ExifParser(exif::Error) } @@ -26,6 +27,7 @@ pub struct Picture { pub taken: Option<String>, hash: String, pub path: PathBuf, + pub file_name: String, } pub struct Converter<'a> { @@ -72,6 +74,10 @@ impl Picture { taken, hash: hash_reader(&mut reader)?, path: path.to_path_buf(), + file_name: match path.file_name() { + Some(fname) => Ok(fname.to_string_lossy().to_string()), + None => Err(LoadError::PathError), + }?, }) } |