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

Feature: Configurable width/size for base64 placeholder with webp support and backgroundColor fallback #10705

Closed
polarathene opened this issue Dec 28, 2018 · 2 comments · Fixed by #10944

Comments

@polarathene
Copy link
Contributor

polarathene commented Dec 28, 2018

Summary

Configurable width/size for placeholder image in gatsby-image.

Webp support for base64 placeholder image element, and compatibility with the backgroundColor element to use as fallback for those that don't have Webp(due to inlining base64, less benefit to support multiple image formats, 2019 a good portion of users should have webp access).

Basic example

A global option in gatsby-config.js for width/size and maybe a prop for the image component for overriding? Nothing else really changes API wise, you just get the ability to also use webp format for the base64 placeholder image, and compatibility/fallback with backgroundColor element.

Motivation

Configurable width/size for placeholder image in gatsby-image. 20px vs 40px can make quite a bit of difference in the preview aesthetic. Facebook if I'm not mistaken uses around 40px and Medium 30px.

I'd also like this base64 inlined data to be webp, I notice it's jpeg(and I think can also be png if input is png?). I take it webp is not supported there as the placeholder does not use the <picture> element? Firefox presently doesn't have support for webp, but it's current beta and nightly both do so it's users will be able to benefit from webp as well from 2019. There's also a polyfill now.

To better handle users who browsers do not support webp, I would like to also use the backgroundColor placeholder as a fallback. Presently this is not possible as the backgroundColor element is after/above the image placeholder element... An alternative would be to use background-color style on the image element? The element order could be rearranged, but the styles conflict a little, image element has a 500ms opacity transition while the backgroundColor element has a 350ms transition delay(no transition duration on opacity, just a delay before it switches).

Custom styles could be passed in to resolve the placeholder issues, but I think some/all of those could be addressed by updating the source directly?

I'd like to contribute all of the above features/changes if anyone else thinks they'd be value in doing so.

@polarathene polarathene changed the title Feature: Configurable aspectRatio for base64 placeholder with webp support and backgroundColor fallback Feature: Configurable width/size for base64 placeholder with webp support and backgroundColor fallback Jan 9, 2019
@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 13, 2019
@gatsbot
Copy link

gatsbot bot commented Feb 13, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

@polarathene
Copy link
Contributor Author

polarathene commented Feb 14, 2019

@gatsbybot Not stale, still waiting on feedback.

PR here

@m-allanson m-allanson added not stale and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants