prismicio / gatsby-source-prismic-graphql

Gatsby source plugin for Prismic GraphQL
MIT License
17 stars 14 forks source link

Image crops are not respected #41

Open schwigri opened 4 years ago

schwigri commented 4 years ago

When calling for a different crop of an image, the same image is returned (default crop).

Example query:

query MyQuery {
  prismic {
    allPosts(lang: "en-us", sortBy: meta_firstPublicationDate_DESC) {
      edges {
        node {
          featured_image
          featured_imageSharp {
            childImageSharp {
              fixed {
                aspectRatio
                src
              }
            }
          }
          mobile_image: featured_imageSharp(crop: "mobile_card") {
            childImageSharp {
              fixed {
                aspectRatio
                src
              }
            }
          }
        }
      }
    }
  }
}

Result (condensed to relevant part):

              "featured_imageSharp": {
                "childImageSharp": {
                  "fixed": {
                    "aspectRatio": 1.0282776349614395,
                    "src": "/static/16741ff4edd74e86fafd1af715af61c9/2244e/d307b38b-ff40-45d2-ad5c-62d40dea9b0b_the-new-york-public-library-yEauzeZU6xo-unsplash.jpg"
                  }
                }
              },
              "mobile_image": {
                "childImageSharp": {
                  "fixed": {
                    "aspectRatio": 1.0282776349614395,
                    "src": "/static/16741ff4edd74e86fafd1af715af61c9/2244e/d307b38b-ff40-45d2-ad5c-62d40dea9b0b_the-new-york-public-library-yEauzeZU6xo-unsplash.jpg"
                  }
                }
              }

The aspect ratio and src are the exact same despite having mobile_card crop in Prismic set to be a different aspect ratio.

MarcMcIntosh commented 4 years ago

Hi @schwigri Could you provide a recreation of this in the examples directory and open a PR?