-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Download images from Prismic to use in gatsby-image #14076
Comments
You would need to use gatsby-transformer-sharp and gatsby-plugin-sharp so you can use gatsby-image. On your query it would look something like this: const homepageQuery = useStaticQuery(graphql`
query PrismicQuery {
prismic {
allHomepages {
edges {
node {
section1_image {
localFile {
childImageSharp {
fluid(quality: 100) {
...GatsbyImageSharpFluid_withWebp
}
}
}
}
}
}
}
}
}`
) And gatsby-config. module.exports = {
plugins: [`gatsby-plugin-sharp`, `gatsby-transformer-sharp`],
} |
@daydream05 gatsby-image under the hood use gatsby-transformer-sharp and this plugin also not supported. |
@ppsirius Have you tried it? This is how it's usually done with sources that doesn't have their own image processing. You pull from the source, and you apply transformer sharp on it. If you look at wordpress source plugin, this is how they query it as well. I also use Prismic for one of my sites, and looking at my codebase, I can't think of any other way how I was able to do it. Here's an example codebase of how to use gatsby-image with Prismic. If you check, it also uses |
@daydream05 He is using the GraphQL plugin, not the normal source plugin :) @freiksenet Could you chime in here and maybe answer if this is possible / when this is possible? |
@daydream05 Not at all, thanks to You I notice that I use a different plugin that doesn't support image optimization. I switch to right plugin and everything works fine 😎 |
@ppsirius so what is the right plugin? |
@kamilDevguru gatsby-source-prismic 😎 |
@ppsirius So you got gatsby-plugin-remote-images to work with images from Prismic? Would you be able to share some of your code? |
@mathiasha As I mentioned earlier I use gatsby-source-prismic here You have code where I use it. |
How is it possible to use Gatsby's Image Processing with Prismic when i get a json string returned from my query? |
@ppsirius im a little confused..In Prismic what is the type of |
yes |
@ppsirius I get this error if I try what you suggested. This is my query:
|
You use gatsby-source-prismic? |
@ppsirius Hey, sorry for the delayed response. I was using the incorrect plugin. i switched over to gatsby-source-prismic and it all worked. Thanks! |
I think most users have a confusion between two plugins available: gatsby-source-prismic-graphql and gatsby-source-prismic. Please see this link: [https://user-guides.prismic.io/en/articles/3647135-how-to-migrate-a-project-from-gatsby-source-prismic-to-gatsby-source-prismic-graphql](gatsby source prismic vs source-prismic-graphql). You can use If you are using gatsby-source-prismic-graphql, you should see another attribute for gatsby image after image field by itself as the example below:
|
I use gatsby-source-prismic-graphql and want to use gatsby-image. Plugin from prismic doesn't support that feature so I thinking about workaround.
I want to download files and then try to use plugin form images.
I have that query in page component (but also want to work with templates):
I check gatsby-plugin-remote-images but I must give there nodeType but I don't have few of them, not one :[
The text was updated successfully, but these errors were encountered: