Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

gatsby plugin image

npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-sharp
Comment

gatsby image

npm install --save gatsby-transformer-sharp gatsby-plugin-sharp
Comment

Gatsby Plugin Image

import { graphql } from "gatsby"
import { GatsbyImage, getImage } from "gatsby-plugin-image"

function BlogPost({ data }) {
  const image = getImage(data.blogPost.avatar)
  return (
    <section>
      <h2>{data.blogPost.title}</h2>
      <GatsbyImage image={image} alt={data.blogPost.author} />
      <p>{data.blogPost.body}</p>
    </section>
  )
}

export const pageQuery = graphql`
  query {
    blogPost(id: { eq: $Id }) {
      title
      body
      author
      avatar {
        childImageSharp {
          gatsbyImageData(
            width: 200
            placeholder: BLURRED
            formats: [AUTO, WEBP, AVIF]
          )
        }
      }
    }
  }
`
Comment

PREVIOUS NEXT
Code Example
Shell :: installing mysql on aws using putty terminal 
Shell :: bash check in gem is installed 
Shell :: gnome terminator 
Shell :: bash read file into array 
Shell :: git push unable to create temporary object directory 
Shell :: powershell show calendar 
Shell :: make directory in linux 
Shell :: install document viewer ubuntu 
Shell :: how to convert 30fps to 60fps using ffmpeg 
Shell :: recover git stash clear 
Shell :: bash find touch 
Shell :: delete whole line in vi 
Shell :: convert to png images liunx 
Shell :: bison install in kali linux 
Shell :: install go on mac brew 
Shell :: how to run "npm start" ansible pm2 
Shell :: hadoop delete directory without url 
Shell :: wifi drivers realtek 8852 for Ubuntu 
Shell :: how to delete github repo 
Shell :: ssh command 
Shell :: regex in batch file 
Shell :: vim colorscheme 
Shell :: Remove duplicated files from git 
Shell :: git clone only single file 
Shell :: linux list recursive 
Shell :: install cypress for nextjs 
Shell :: docker get in python container 
Shell :: does npm install takes arguments 
Shell :: download directory ssh linux 
Shell :: diskpart 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =