Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Image optimization to RichText #523

Open
curiosus42 opened this issue Dec 5, 2022 · 0 comments
Open

Add Image optimization to RichText #523

curiosus42 opened this issue Dec 5, 2022 · 0 comments

Comments

@curiosus42
Copy link

Is your feature request related to a problem? Please describe.

Images which are present in RichText fields are not thoroughly optimized, except for the default imgix optimizations. Large images uploaded to prismic are served for ex. in insane resolutions.

Describe the solution you'd like

It would be great to add image optimization arguments during data fetching with gatsby-image or to support easy-to-use optimization of images with imgix after data fetching prismic.

Idea: Add image field support to PrismicStructuredText GraphQL Type. Currently it only returns an AST. It would be great, if we could directly add image optimization arguments to the graphql query or query the referenced images seperately.

Ex.

content {
    richText {
        images {
            gatsbyImageData(
                  width: 720
                  placeholder: BLURRED
                  aspectRatio: 1
            )
        }
    }
}

or

content {
    richText {
        ... on Image {
            // ...
        }
    }
}

or

content {
    richText(
        width: 720
        placeholder: BLURRED
        aspectRatio: 1
    )
}

Describe alternatives you've considered

  • Create a gatsby transformer plugin following the approach of gatsby-remark-images to optimize images in rich text during build time
  • Pre optimize images before upload to prismic
  • Use the PrismicRichText component to somehow optimize images on the fly

Additional context

Thank you very much for all your effort and support. Right now Prismic + Gatsby seems like the only good option because the source plugin is well maintained. I'm looking forward to tackle great projects with this stack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant