1

我在 Contentful 中有各种尺寸的图像,即宽度为 200 像素、600 像素、800 像素、1000 像素等。

如果我responsiveresolution按照 gatsby.js 文档使用,它将提高我的小图像的分辨率:

allContentfulProduct {
    edges {
      node {
        id
        productName
        image {
          responsiveResolution(width: 600) {
            width
            height
            src
            srcSet
          }
        }
      }
    }
  }
}

如何从 Contentful 获得图像的自然分辨率?responsiveresolution在 gatsby.js 中可以使用更好的文档!

4

1 回答 1

4

您可以通过运行此查询获得自然分辨率。

allContentfulProduct {
    edges {
      node {
        id
        productName
        image {
          file{
            url
          }
        }
      }
    }
  }
}

responsiveResolution只是一个助手,你可以完全查询没有它的图像,就像你查询任何其他条目一样。

于 2017-08-31T11:25:04.663 回答