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({ ...@@ -417,11 +417,9 @@ export async function optimizeImage({
if (height) { if (height) {
transformer.resize(width, height) transformer.resize(width, height)
} else { } else {
const { width: metaWidth } = await transformer.metadata() transformer.resize(width, undefined, {
withoutEnlargement: true,
if (metaWidth && metaWidth > width) { })
transformer.resize(width)
}
} }
if (contentType === AVIF) { 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