@@ -60,7 +60,8 @@ export async function getImage(url: string) {
|
|||||||
const response = await fetch(ensureJpeg(url))
|
const response = await fetch(ensureJpeg(url))
|
||||||
const arrayBuf = await response.arrayBuffer()
|
const arrayBuf = await response.arrayBuffer()
|
||||||
if (response.status !== 200) return null
|
if (response.status !== 200) return null
|
||||||
return sharp(arrayBuf)
|
return (
|
||||||
|
sharp(arrayBuf)
|
||||||
.resize({
|
.resize({
|
||||||
width: MAX_AVATAR_RENDER_PX,
|
width: MAX_AVATAR_RENDER_PX,
|
||||||
height: MAX_AVATAR_RENDER_PX,
|
height: MAX_AVATAR_RENDER_PX,
|
||||||
@@ -71,6 +72,7 @@ export async function getImage(url: string) {
|
|||||||
// jpeg, and the default (80) visibly softens avatars at card sizes
|
// jpeg, and the default (80) visibly softens avatars at card sizes
|
||||||
.jpeg({quality: 95})
|
.jpeg({quality: 95})
|
||||||
.toBuffer()
|
.toBuffer()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CDN URLs end with @jpeg, @webp, or no extension (which may default to webp).
|
// CDN URLs end with @jpeg, @webp, or no extension (which may default to webp).
|
||||||
|
|||||||
Reference in New Issue
Block a user