Add multiple images from a directory with gatsby-image

Kyle Gill
InstructorKyle Gill

Share this video with your friends

Send Tweet

Learn how to query multiple local images so they can easily be displayed on a Gatsby site side-by-side.

Joey Ng'ethe
Joey Ng'ethe
~ 2 years ago

This is all nice for local images. What if you have images coming from an API just as a string which is the image url. Can you use the Image component? Any ideas on how to use this?

Kyle Gill
Kyle Gillinstructor
~ 2 years ago

This is all nice for local images. What if you have images coming from an API just as a string which is the image url. Can you use the Image component? Any ideas on how to use this?

Hey Joe, yes, it does add another layer of complexity for images from an API. You might want to look into the createRemoteFileNode API which is a helper in gatsby-source-filesystem or look into how it's implemented by plugins like [gatsby-plugin-remote-images] or even OS plugins from CMS providers like Contentful which process images from remote sources at build time to create image nodes.