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/context.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/context.rs') diff --git a/src/context.rs b/src/context.rs index 925db0b..f7b97ed 100644 --- a/src/context.rs +++ b/src/context.rs @@ -4,12 +4,12 @@ use std::io; use std::path::{Path, PathBuf}; use structopt::StructOpt; -use serde::Deserialize; +use serde::{Serialize, Deserialize}; use tera::{Tera, Filter, Value}; const TMPL_FILES: &'static [&'static str] = &["index.html"]; -#[derive(Debug, StructOpt)] +#[derive(Debug, StructOpt, Serialize)] #[structopt(name = "gallery")] pub struct Options { #[structopt(long, help = "Just a thing")] @@ -23,10 +23,8 @@ pub struct Options { #[structopt(long, short, default_value = "build", help = "Where to build site")] pub builddir: PathBuf, - #[structopt(long, default_value = "1080", help = "Scaled size for image")] - pub size_scaled: u32, - #[structopt(long, default_value = "720", help = "Thumbnail size for image")] - pub size_thumb: u32, + #[structopt(long, help = "Full size url prefix")] + pub url_prefix: Option, } #[derive(Debug)] @@ -37,10 +35,11 @@ pub enum ConfigError { CompileTemplate(tera::Error), } -#[derive(Deserialize, Debug)] +#[derive(Deserialize, Debug, Serialize)] pub struct Config { pub imageglob: String, pub info: HashMap, + pub sizes: HashMap, #[serde(skip)] pub imageglob_compiled: glob::Pattern, @@ -126,8 +125,6 @@ impl Filter for ReltoFilter { Err(tera::Error::msg("Input to relto filter must be string")) } } - - fn is_safe(&self) -> bool { true } } impl Config { -- cgit v1.2.3