mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-21 14:17:08 +00:00
* Resize post thumbnails (fixes #4053) * 256px
This commit is contained in:
parent
f5066b1f0b
commit
a051772fff
|
@ -75,6 +75,8 @@
|
|||
"ProxyAllImages"
|
||||
# Timeout for uploading images to pictrs (in seconds)
|
||||
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: {
|
||||
|
|
|
@ -354,9 +354,10 @@ async fn generate_pictrs_thumbnail(image_url: &Url, context: &LemmyContext) -> L
|
|||
// fetch remote non-pictrs images for persistent thumbnail link
|
||||
// TODO: should limit size once supported by pictrs
|
||||
let fetch_url = format!(
|
||||
"{}image/download?url={}",
|
||||
"{}image/download?url={}&resize={}",
|
||||
pictrs_config.url,
|
||||
encode(image_url.as_str())
|
||||
encode(image_url.as_str()),
|
||||
context.settings().pictrs_config()?.max_thumbnail_size
|
||||
);
|
||||
|
||||
let res = context
|
||||
|
|
|
@ -90,6 +90,10 @@ pub struct PictrsConfig {
|
|||
/// Timeout for uploading images to pictrs (in seconds)
|
||||
#[default(30)]
|
||||
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)]
|
||||
|
|
Loading…
Reference in a new issue