Skip to content

Commit

Permalink
Fix issues with single svg images
Browse files Browse the repository at this point in the history
  • Loading branch information
neokry committed Nov 23, 2023
1 parent c3b494b commit ae889ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/web/src/pages/api/renderer/stack-images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
// Handle single image
if (typeof images === 'string') {
const data = await getImageData(images)
const convertedImage = await sharp(data).webp({ quality: 100 }).toBuffer()

res.setHeader(
'Cache-Control',
`public, s-maxage=${maxAge}, stale-while-revalidate=${swr}`
)
res.setHeader('Content-Type', 'image/webp')
return res.send(data)
return res.send(convertedImage)
}

// Handle multiple images
Expand Down

0 comments on commit ae889ae

Please sign in to comment.