diff options
| -rw-r--r-- | src/routes/user/[user]/badges/+page.svelte | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte index 365fdb9b..9b7b8f07 100644 --- a/src/routes/user/[user]/badges/+page.svelte +++ b/src/routes/user/[user]/badges/+page.svelte @@ -284,11 +284,14 @@ }; const thumbnail = (url: string | undefined) => { + const width = 144; + const height = 200; + if (url && url.includes('catbox.moe') && !url.includes('gif')) return url.replace('catbox.moe/', 'catbox.moe/thumbs/t_'); if (url && url.includes('imgur') && !url.includes('gif')) - return url.replace(/(\.\w+)$/, '_d.webp?maxwidth=144&shape=thumb&fidelity=high'); + return url.replace(/(\.\w+)$/, `_d.webp?maxwidth=${width}&shape=thumb&fidelity=high`); if (url && url.includes('discordapp')) { const match = url.match(/attachments\/(\d+)\/(\d+)\/(.+)/); @@ -296,7 +299,7 @@ if (match) { const [_, server, id, file] = match; - return `https://media.discordapp.net/attachments/${server}/${id}/${file}?width=144&height=200`; + return `https://media.discordapp.net/attachments/${server}/${id}/${file}?width=${width}&height=${height}`; } } |