mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-12-26 09:50:36 +00:00
parent
b0c3185663
commit
3b0be52e67
2 changed files with 8 additions and 3 deletions
|
@ -45,7 +45,7 @@ struct Images {
|
|||
#[derive(Deserialize)]
|
||||
struct PictrsParams {
|
||||
format: Option<String>,
|
||||
thumbnail: Option<String>,
|
||||
thumbnail: Option<i32>,
|
||||
}
|
||||
|
||||
#[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,);
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
admin_password: "lemmylemmy"
|
||||
site_name: "lemmy-dev"
|
||||
}
|
||||
database: {
|
||||
host: postgres
|
||||
}
|
||||
|
||||
database: {
|
||||
host: "postgres"
|
||||
|
|
Loading…
Reference in a new issue