Code Monkey home page Code Monkey logo

Comments (2)

partik03 avatar partik03 commented on September 23, 2024

@olavea I was looking to take up this one but can you explain a little bit more about the requirements of this issue?

from gatsby-transformer-cloudinary.

olavea avatar olavea commented on September 23, 2024

Hey @partik03

The current solution lets you define types that should get the gatsbyImageData resolver added. However it requires the data on the type to conform to a very specific shape. The new solution should let the user of the plugin configure where on the type to find the data it needs.
The feature might easiest be explained by how the configuration should look when done. For a Cloudinary image in Sanity the gatsby-config.js of the user should look like:

module.exports = {
  plugins: [
    {
      resolve: `gatsby-transformer-cloudinary`,
      options: {
        // Add the `gatsbyImageData` resolver to `BlogPostHeroImage`
        transformTypes: [
          `BlogPostHeroImage`,
          {
            type: `SanityCloudinaryAsset`,
            cloudName: () => `example-cloud`, // Manually configure the cloud name by returning it from a function
            publicId: (data) => data.public_id, // Use the value of public_id from SanityCloudinaryAsset
            originalHeight: `height`, // Convenience alternative to the above by defining the path on SanityCloudinaryAsset where height can be found
            originalWidth: `width`,
            originalFormat: `format`
          }
        ],
        // Optional transformation option
        defaultTransformations: ['c_fill', 'g_auto', 'q_auto'],
      },
    },
    `gatsby-plugin-image`,
  ],
};

I apologize for the late reply.

Any follow up questions from you would be welcome 😺 👍

from gatsby-transformer-cloudinary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.