gatsby-plugin-sharp "height has to be a positive int larger than zero (> 0), now it's 0" #35910
Closed
2 tasks done
Labels
status: confirmed
Issue with steps to reproduce the bug that’s been verified by at least one reviewer.
topic: media
Related to gatsby-plugin-image, or general image/media processing topics
type: bug
An issue or pull request relating to a bug in Gatsby
Preliminary Checks
Description
Hello everyone,
First off, I'd like to start by thanking everyone involved with the project. It's been a pleasure using Gatsby on our website for the past 3 years.
I have run into what I believe to be an edge case with the
gatsby-plugin-sharp
plugin, where images much wider than high (1300x10px in my case) can cause issues when they are combined with theplaceholder: BLURRED
parameter like so:Running
npm run build
leads to this error message:Reproduction Link
https://github.com/ThomasVandenhede/gatsby-test-project
Steps to Reproduce
npm i && npm run build
Important parameters needed to reproduce this issue are:
gatsby-plugin-sharp
"blurredOptions"
to their default value (changing theheight
/width
field could theoretically prevent the issue)BLURRED
placeholdersExpected Result
The build process should not crash even when unusually wide images are processed through gatsby-plugin-sharp.
The blurred version of the images should be at least 20x1 pixels.
Actual Result
Right now, images whose aspect ratio is more than 20:1 can lead to issues, especially when the
blurredOptions
option has not been provided, since the default width for blurred base64 images is 20px.gatsby/packages/gatsby-plugin-sharp/src/image-data.ts
Line 16 in 392d6bc
For such images, base64 blurred images should be at least 1px high to prevent the build process from failing.
Environment
Config Flags
No response
The text was updated successfully, but these errors were encountered: