From: Nutomic Date: Fri, 28 Oct 2022 14:34:40 +0000 (+0000) Subject: Image improvements (#2513) X-Git-Url: http://these/git/%22https:/nerdica.net/photo/contact/80/README.ja.md?a=commitdiff_plain;h=3b0be52e673a4ac851c8df688a29e1fe828fb7a4;p=lemmy.git Image improvements (#2513) * Image improvements * remove rate limits --- diff --git a/crates/routes/src/images.rs b/crates/routes/src/images.rs index 3eb9bfd4..cb7187d5 100644 --- a/crates/routes/src/images.rs +++ b/crates/routes/src/images.rs @@ -45,7 +45,7 @@ struct Images { #[derive(Deserialize)] struct PictrsParams { format: Option, - thumbnail: Option, + thumbnail: Option, } #[derive(Deserialize)] @@ -130,8 +130,10 @@ async fn full_res( let url = if params.format.is_none() && params.thumbnail.is_none() { format!("{}image/original/{}", pictrs_config.url, name,) } else { - // Use jpg as a default when none is given - let format = params.format.unwrap_or_else(|| "jpg".to_string()); + // Take file type from name, or jpg if nothing is given + let format = params + .format + .unwrap_or_else(|| name.split('.').last().unwrap_or("jpg").to_string()); let mut url = format!("{}image/process.{}?src={}", pictrs_config.url, format, name,); diff --git a/docker/dev/lemmy.hjson b/docker/dev/lemmy.hjson index 23f40520..2bd0675a 100644 --- a/docker/dev/lemmy.hjson +++ b/docker/dev/lemmy.hjson @@ -10,6 +10,9 @@ admin_password: "lemmylemmy" site_name: "lemmy-dev" } + database: { + host: postgres + } database: { host: "postgres"