Unverified Commit aeef38e8 authored by Jesse Zhu's avatar Jesse Zhu Committed by GitHub

Use withoutEnlargement instead of sharp.metadata() (#44890)

parent 3a9bfe60
......@@ -417,11 +417,9 @@ export async function optimizeImage({
if (height) {
transformer.resize(width, height)
} else {
const { width: metaWidth } = await transformer.metadata()
if (metaWidth && metaWidth > width) {
transformer.resize(width)
}
transformer.resize(width, undefined, {
withoutEnlargement: true,
})
}
if (contentType === AVIF) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment