Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(image): handle image imports with high aspect ratio #40563

Merged
merged 5 commits into from Sep 16, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions packages/next/build/webpack/loaders/next-image-loader.js
Expand Up @@ -35,12 +35,18 @@ function nextImageLoader(content) {
// Shrink the image's largest dimension
if (imageSize.width >= imageSize.height) {
blurWidth = BLUR_IMG_SIZE
blurHeight = Math.round(
(imageSize.height / imageSize.width) * BLUR_IMG_SIZE
blurHeight = Math.max(
Math.round(
(imageSize.height / imageSize.width) * BLUR_IMG_SIZE
),
1
)
} else {
blurWidth = Math.round(
(imageSize.width / imageSize.height) * BLUR_IMG_SIZE
blurWidth = Math.max(
Math.round(
(imageSize.width / imageSize.height) * BLUR_IMG_SIZE
),
1
)
blurHeight = BLUR_IMG_SIZE
}
Expand Down