Enable GraphQL support for Product images
mrmikardo opened this issue · 4 comments
Any GraphQL File object that contains an image has a childImageSharp
field that you can query and pass to Gatsby image components (using gatsby-plugin-image
). It would be very cool if it were possible to do the same thing with gatsby-source-stripe
when retrieving Product images. This would allow seamless interaction between the gatsby-image-plugin
and gatsby-stripe-plugin
to display product images.
At present, querying for the image
field on a product returns something like the following;
{
"data": {
"stripePrice": {
"id": "price_1KEBiRGuNIhpNc5curNr3z04",
"product": {
"description": "A tote bag 4 u <3",
"images": [
"https://files.stripe.com/links/MDB8YWNjdF8xN2JIV29HdU5JaHBOYzVjfGZsX3Rlc3RfMUhlM0hwbEFaSkUxdDJjZkVtejNnQmR500hXn0ZUFq"
],
"name": "Fancy tote"
}
}
},
"extensions": {}
}
i.e. an array of links that can be used to download the image file. Somehow you'd need to convert this to a File(-like?) object so that GraphQL / gatsby-plugin-image
could expand an associated childImageSharp
field. From a glance, it looks like it might be possible to use the FileDownloadService
class to do this?
Docs for gatsby-plugin-image
: https://www.gatsbyjs.com/plugins/gatsby-plugin-image
Hello! So as per our README, users do have the ability to download the files, which then I assume these downloaded files could be passed to other plugins, but I don't have a lot of insight in that area as I wasn't the creator of that download feature within this plugin.
Feel free to give it a whirl and see if it does what you need! And if it does, we always encourage README additions to help guide other users that might have the same question / thought. And if it doesn't, feel free to update the plugin as needed and create a PR for review! There are some instructions on how to get the plugin running locally in the README; I'd also be happy to help debug any issues you might run into getting it spun up locally.
Thanks!
The person who implemented the downloadFiles feature also created this gatsby-stripe-starter, which might integrate with gatsby-plugin-stripe
as well / have an example you could look at: https://github.com/brxck/gatsby-starter-stripe. Just thought I'd mention in case it's helpful!
@njosefbeck thanks for the swift reply! 🙇
I've had a play with the downloadFiles
- this does pretty much exactly what I need! So I reckon this issue can be considered closed.
Happy to help, and glad that that worked for you!