From d7244c2cc7b8f62f2f42cca7f3dece89c30bf105 Mon Sep 17 00:00:00 2001 From: Julian T Date: Mon, 26 Jul 2021 23:50:07 +0200 Subject: Add scaled image to page --- src/picture.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/picture.rs') 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, 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), + }?, }) } -- cgit v1.2.3