From 296313e5084cf6e28a28626211bfc77110e7cf8c Mon Sep 17 00:00:00 2001 From: Xyphyn Date: Wed, 6 Sep 2023 19:14:32 -0700 Subject: [PATCH] misc: remove thumb arg if width is high enough --- src/lib/components/lemmy/post/helpers.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/components/lemmy/post/helpers.ts b/src/lib/components/lemmy/post/helpers.ts index 793f0065..d573c008 100644 --- a/src/lib/components/lemmy/post/helpers.ts +++ b/src/lib/components/lemmy/post/helpers.ts @@ -12,6 +12,11 @@ export const bestImageURL = ( compact: boolean = true, width: number = 1024 ) => { + if (width > 1024) { + if (post.url) return `${post.url}?format=webp` + else if (post.thumbnail_url) return `${post.thumbnail_url}?format=webp` + } + if (compact && post.thumbnail_url) return `${post.thumbnail_url}?thumbnail=256&format=webp` else if (compact && post.url) return `${post.url}?thumbnail=256&format=webp`