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

Make the Plugin Support Cloudinary Assets Sourced Via CMSs #245

Open
olavea opened this issue Oct 1, 2023 · 2 comments
Open

Make the Plugin Support Cloudinary Assets Sourced Via CMSs #245

olavea opened this issue Oct 1, 2023 · 2 comments
Assignees
Labels
feature New functionality

Comments

@olavea
Copy link
Collaborator

olavea commented Oct 1, 2023

We are looking to make the plugin seamlessly support Cloudinary assets sourced via CMSs and other sources.

  1. Let the user configure where to find the Cloudinary data (ie. GraphQL Type) and
  2. Let the user configure where on the type to find public id, cloud name, original height, original width and mime type.

Code this similarly to gatsby-remote-images: config docs link
Make the Plugin Support Cloudinary Assets Sourced Via CMSs #245

@olavea olavea added feature New functionality hacktoberfest labels Oct 1, 2023
@partik03
Copy link

partik03 commented Oct 7, 2023

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

@olavea
Copy link
Collaborator Author

olavea commented Oct 16, 2023

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 😺 👍

raae added a commit that referenced this issue Feb 13, 2024
Allows for sourced data with invalid data shape by configuring a map from invalid to valid data shape.
github-actions bot pushed a commit that referenced this issue Feb 13, 2024
# [4.6.0-beta.1](v4.5.0...v4.6.0-beta.1) (2024-02-13)

### Features

* configurable transform types [#245](#245) ([#250](#250)) ([202ed12](202ed12))
github-actions bot pushed a commit that referenced this issue Jun 6, 2024
# [4.6.0-cname-private-cdn-support.1](v4.5.0...v4.6.0-cname-private-cdn-support.1) (2024-06-06)

### Features

* cname, private cdn support ([3a82b2f](3a82b2f))
* configurable transform types [#245](#245) ([#250](#250)) ([202ed12](202ed12))
@raae raae self-assigned this Jun 6, 2024
@raae raae removed the hacktoberfest label Jun 6, 2024
github-actions bot pushed a commit that referenced this issue Jun 7, 2024
# [4.6.0](v4.5.0...v4.6.0) (2024-06-07)

### Features

* cname, private cdn support ([#252](#252)) ([db13e3d](db13e3d)), closes [#251](#251)
* configurable transform types [#245](#245) ([#250](#250)) ([202ed12](202ed12))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New functionality
Projects
None yet
Development

No branches or pull requests

3 participants