Skip to content

Commit

Permalink
fix: assign minimal value for blurHeight (#273)
Browse files Browse the repository at this point in the history
* fix: assign minimal value for blurHeight

* dummy me, min => max
  • Loading branch information
Kotyarishka authored Dec 20, 2024
1 parent 97b5a5c commit f7ca1f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const getImageMetadata = async (buffer: Buffer): Promise<Omit<Image, 'src
if (width == null || height == null) return
const aspectRatio = width / height
const blurWidth = 8
const blurHeight = Math.round(blurWidth / aspectRatio)
const blurHeight = Math.max(1, Math.round(blurWidth / aspectRatio))
const blurImage = await img.resize(blurWidth, blurHeight).webp({ quality: 1 }).toBuffer()
const blurDataURL = `data:image/webp;base64,${blurImage.toString('base64')}`
return { height, width, blurDataURL, blurWidth, blurHeight }
Expand Down

0 comments on commit f7ca1f7

Please sign in to comment.