parent
b0c3185663
commit
3b0be52e67
2 changed files with 8 additions and 3 deletions
|
@ -45,7 +45,7 @@ struct Images {
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct PictrsParams {
|
struct PictrsParams {
|
||||||
format: Option<String>,
|
format: Option<String>,
|
||||||
thumbnail: Option<String>,
|
thumbnail: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
@ -130,8 +130,10 @@ async fn full_res(
|
||||||
let url = if params.format.is_none() && params.thumbnail.is_none() {
|
let url = if params.format.is_none() && params.thumbnail.is_none() {
|
||||||
format!("{}image/original/{}", pictrs_config.url, name,)
|
format!("{}image/original/{}", pictrs_config.url, name,)
|
||||||
} else {
|
} else {
|
||||||
// Use jpg as a default when none is given
|
// Take file type from name, or jpg if nothing is given
|
||||||
let format = params.format.unwrap_or_else(|| "jpg".to_string());
|
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,);
|
let mut url = format!("{}image/process.{}?src={}", pictrs_config.url, format, name,);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
admin_password: "lemmylemmy"
|
admin_password: "lemmylemmy"
|
||||||
site_name: "lemmy-dev"
|
site_name: "lemmy-dev"
|
||||||
}
|
}
|
||||||
|
database: {
|
||||||
|
host: postgres
|
||||||
|
}
|
||||||
|
|
||||||
database: {
|
database: {
|
||||||
host: "postgres"
|
host: "postgres"
|
||||||
|
|
Loading…
Reference in a new issue