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

Unable to retrieve format transformations when querying for gatsbyImageData in graphql #134

Closed
Mcdonamj087 opened this issue Oct 26, 2021 · 1 comment

Comments

@Mcdonamj087
Copy link

I'm running Gatsby version ^4.0.1 and the gatsby-source-sanity version ^7.1.0. After deploying my Sanity graphql api, I am in my http://localhost:8000/___graphql and attempting to query an image asset, supplying format params for gatsbyImageData, yet it is still just returning the .jpg format i've uploaded. See screenshot below.

Is this a version issue? What am i doing wrong?

Screen Shot 2021-10-25 at 9 41 36 PM

@hdoro
Copy link
Contributor

hdoro commented Oct 26, 2021

Thanks for reporting, Matt!

At the moment, this is intentional. We haven't implemented the formats option in our usage of gatsbyImageData, and I'm not sure we ever will. Our CDN can serve the best format for the user based on their device's capabilities through the auto=format query parameter.

This means that by using that data in your screenshot, users will automatically get WebP if their device supports it, and JPG if not. We have plans for supporting AVIF, and when that happens you'll get it in all of your images solely by using the auto=format parameter.

You can read more about image transformations if you want an extra level of control over your images.

I'm closing this issue, for now, assuming our image CDN achieves your desired outcome. If that's not the case and you have a need for static formats, do let us know, though. We're glad to consider it for our roadmap 😄

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

No branches or pull requests

2 participants