Learn how to install and setup gatsby-image plugins to source local images from the filesystem so you can query them with GraphQL, and then use them in your site.
Instructor: [00:00] In order to use the Gatsby Image component, you'll need to install the package. Run npm install --save gatsby-image.
[00:07] Gatsby Image requires you to pass in image data, generally provided by a plug-in. To source images from the filesystem, you'll need several additional plugins. Install gatsby-source-filesystem, gatsby-plugin-sharp, and gatsby-transformer-sharp.
[00:20] The sharp and filesystem plugins need to be included in the Gatsby config. The sharp plugins don't need any configurations, so you can include them as strings. The filesystem plugin needs to be told where the images are, in my case, in source images.
[00:41] Now, restarting the server will include the images in the GraphQL data layer as image sharp nodes. You can actually see the optimized image files Gatsby's using in the public folder if you navigate through it.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!