diff options
| author | WriterV2 <primary-v2@protonmail.com> | 2023-01-28 10:55:10 +0100 |
|---|---|---|
| committer | WriterV2 <primary-v2@protonmail.com> | 2023-01-28 10:55:10 +0100 |
| commit | c6cd96ed28f57ae5573a8ecad1acc9179c1e7aef (patch) | |
| tree | 88985d50bd9c0ef0559b4733f5bab1186987fed8 /src | |
| parent | c151561da778d4e7daf6fb42af7340ff604d7ba7 (diff) | |
Remove workcard images
Diffstat (limited to 'src')
| -rw-r--r-- | src/images_processing.rs | 24 | ||||
| -rw-r--r-- | src/main.rs | 2 | ||||
| -rw-r--r-- | src/works/stories.rs | 1 |
3 files changed, 0 insertions, 27 deletions
diff --git a/src/images_processing.rs b/src/images_processing.rs deleted file mode 100644 index 483d44c..0000000 --- a/src/images_processing.rs +++ /dev/null @@ -1,24 +0,0 @@ -use anyhow::{Context, Result}; - -// resize all work card images to 250 x 250 px -pub fn resize_workcard_images() -> Result<Vec<()>> { - let mut result: Vec<()> = Vec::new(); - for image_file in std::fs::read_dir("images/workcardimages")? { - let path = image_file?.path(); - let filename = if let Some(name) = &path.to_str() { - Ok(format!("docs/{}", name)) - } else { - Err(anyhow::Error::msg("")) - }; - - let img = image::open(&path)?; - let processed_image = img.resize(250, 250, image::imageops::FilterType::Triangle); - let mut output_file = std::fs::File::create(filename?)?; - result.push( - processed_image - .write_to(&mut output_file, image::ImageFormat::Png) - .with_context(|| format!("Failed to resize work card image from {:?}", path))?, - ); - } - Ok(result) -} diff --git a/src/main.rs b/src/main.rs index 39d4b9d..942b621 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,9 @@ use tera::{Context, Tera}; use crate::works::Works; -mod images_processing; mod works; fn main() -> Result<()> { - images_processing::resize_workcard_images()?; // new tera instance let tera = Tera::new("templates/**/*.html")?; diff --git a/src/works/stories.rs b/src/works/stories.rs index f9f3fb1..11a32e0 100644 --- a/src/works/stories.rs +++ b/src/works/stories.rs @@ -12,7 +12,6 @@ pub struct Story { pub title: String, pub description: String, pub path_to_document: String, - pub path_to_image: String, pub number_of_pages: u16, pub story_type: String, pub language: Language, |
