mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-27 08:16:12 +00:00
* Resize post thumbnails (fixes #4053) * 256px
This commit is contained in:
parent
0ba0d0f9b3
commit
10a28e78d9
|
@ -75,6 +75,8 @@
|
||||||
"ProxyAllImages"
|
"ProxyAllImages"
|
||||||
# Timeout for uploading images to pictrs (in seconds)
|
# Timeout for uploading images to pictrs (in seconds)
|
||||||
upload_timeout: 30
|
upload_timeout: 30
|
||||||
|
# Resize post thumbnails to this maximum width/height.
|
||||||
|
max_thumbnail_size: 256
|
||||||
}
|
}
|
||||||
# Email sending configuration. All options except login/password are mandatory
|
# Email sending configuration. All options except login/password are mandatory
|
||||||
email: {
|
email: {
|
||||||
|
|
|
@ -353,9 +353,10 @@ async fn generate_pictrs_thumbnail(image_url: &Url, context: &LemmyContext) -> L
|
||||||
// fetch remote non-pictrs images for persistent thumbnail link
|
// fetch remote non-pictrs images for persistent thumbnail link
|
||||||
// TODO: should limit size once supported by pictrs
|
// TODO: should limit size once supported by pictrs
|
||||||
let fetch_url = format!(
|
let fetch_url = format!(
|
||||||
"{}image/download?url={}",
|
"{}image/download?url={}&resize={}",
|
||||||
pictrs_config.url,
|
pictrs_config.url,
|
||||||
encode(image_url.as_str())
|
encode(image_url.as_str()),
|
||||||
|
context.settings().pictrs_config()?.max_thumbnail_size
|
||||||
);
|
);
|
||||||
|
|
||||||
let res = context
|
let res = context
|
||||||
|
|
|
@ -90,6 +90,10 @@ pub struct PictrsConfig {
|
||||||
/// Timeout for uploading images to pictrs (in seconds)
|
/// Timeout for uploading images to pictrs (in seconds)
|
||||||
#[default(30)]
|
#[default(30)]
|
||||||
pub upload_timeout: u64,
|
pub upload_timeout: u64,
|
||||||
|
|
||||||
|
/// Resize post thumbnails to this maximum width/height.
|
||||||
|
#[default(256)]
|
||||||
|
pub max_thumbnail_size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document, PartialEq)]
|
#[derive(Debug, Deserialize, Serialize, Clone, SmartDefault, Document, PartialEq)]
|
||||||
|
|
Loading…
Reference in a new issue