-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
chore(blog): Add "Faster Sites with Optimized Media Assets" to blog. #20735
Merged
Merged
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3d4def0
article: Added article, avatar and bio
4dd4975
updated links
4eb8758
Merge remote-tracking branch 'upstream/master'
8a44324
chore: format
378c80b
Update docs/blog/author.yaml
Chuloo 5950dfb
Merge branch 'master' into master
Chuloo 46b2f35
chore: format
2d3080e
Change publish date to March 2nd
hashimwarren 020ae82
Add link to Gatsby Image doc
hashimwarren 49f08ef
Add link to Gatsby source Cloudinary
hashimwarren ed9fe01
Fix internal link
hashimwarren 1628a8d
Merge remote-tracking branch 'upstream/master'
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
docs/blog/2020-01-12-faster-sites-with-optimized-media-assets/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
title: "Faster Sites with Optimized Media Assets" | ||
date: 2020-01-21 | ||
author: William Imoh | ||
excerpt: "Introducing two new Gatsby-Cloudinary plugins for optimized media management in Gatsby apps" | ||
tags: ["media", "cloudinary", "performance", "image", "video"] | ||
--- | ||
|
||
Plugins are at the heart of developing software with Gatsby because they not only extend Gatsby’s robust features but also make available, data from multiple sources. I’m excited to introduce you to two Gatsby plugins: gatsby-source-cloudinary and gatsby-transformer-cloudinary. | ||
|
||
Cloudinary is a cloud-based end-to-end media management platform for many of the world's top brands. With extensive product offerings from an Image management solution, Dynamic Video Platform, and a dynamic digital asset management solution. | ||
|
||
## The Motivation Behind the Scenes | ||
|
||
The two open-source Gatsby-Cloudinary plugins combine the best of both worlds: | ||
|
||
- Gatsby builds high-performance sites with data from multiple sources and fetches declarative data with GraphQL, offering a superior developer experience and a rich ecosystem for developing in ReactJS. | ||
- Cloudinary is an advanced media-management service that offers three key features: | ||
- Optimized media storage and delivery | ||
- Media transformation on data query and on the fly with dynamic URLs | ||
- Digital-asset management for high performance | ||
|
||
For example, an image uploaded to Cloudinary can be retrieved with a dynamic URL that transforms the original image into a cropped circular image, with a fixed width and height. The final URL becomes: | ||
|
||
https://res.cloudinary.com/demo/image/upload/w_400,h_400,c_crop,r_max/w_200/lady.jpg | ||
|
||
Several transformation parameters can be included in the URL to modify the image on the fly. You can find more about [Cloudinary here](http://bit.ly/2GbkeT3). | ||
|
||
Using the Gatsby-Cloudinary plugins, optimized media assets from Cloudinary are bundled with the static files built by Gatsby. Those optimized assets can either be— | ||
|
||
- Sourced directly from Cloudinary with the source plugin. | ||
- Uploaded from local storage to Cloudinary with the transformer plugin. The returned images are transformed into file nodes that are compatible for use with the robust `gatsby-image` component. | ||
|
||
## gatsby-source-cloudinary Plugin | ||
|
||
gatsby-source-cloudinary is a plugin that fetches media assets from Cloudinary. You must first specify the folder from which to query those assets. The plugin then transforms them into Cloudinary file nodes, which can be queried with GraphQL in a Gatsby project. | ||
|
||
Before file nodes are created, Cloudinary optimizes media files queried from its platform by applying the `f_auto` and `q_auto` transformation parameters. Impressively, those parameters optimize delivery format and quality for media assets by over 70 percent. | ||
|
||
## gatsby-transformer-cloudinary Plugin | ||
|
||
`gatsby-image` is a React component that delivers optimized images in Gatsby apps through GraphQL queries. The gatsby-transformer-cloudinary plugin uploads local files to Cloudinary, which then creates `CloudinaryAsset` nodes that are compatible for use in `gatsby-image`. This plugin can also apply Cloudinary media transformations in the GraphQL queries for the queried media assets. | ||
hashimwarren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Preliminary Steps | ||
|
||
The plugins can be used for various JAMstack applications built with Gatsby. The core goal is to store, optimize and deliver media assets with possible transformations. To get started on using the two Gatsby-Cloudinary plugins, follow these steps: | ||
|
||
1. [Create a free account on Cloudinary](http://bit.ly/2v3sy4N). | ||
2. [Create a Gatsby project](https://www.gatsbyjs.org/tutorial/) with any of the Gatsby starters. | ||
hashimwarren marked this conversation as resolved.
Show resolved
Hide resolved
hashimwarren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
3. Configure either of the plugins in the `gatsby-config.js` file. | ||
4. Refer to the [source plugin](http://bit.ly/2NHVshC) or [transformer plugin](http://bit.ly/2sMqe1u) documentation for the procedure on how to query Cloudinary images or upload and transform them with `gatsby-image`, respectively. | ||
|
||
## Next in the Horizon | ||
|
||
Given the ever-growing demand for speedy and usable apps and the continual feature advancements of Cloudinary and Gatsby, maintenance and capability enhancements of the plugins are ongoing. | ||
|
||
Fork, clone, download, and try out the two plugins yourself. If you run into problems, create an issue in the relevant repository or send us pull requests (PRs) and be sure to check out my [blog on Cloudinary](https://cloudinary.com/blog/introducing_cloudinary_s_gatsby_plugins). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest adding a hyperlink to point to https://www.npmjs.com/package/gatsby-source-cloudinary. This would give the option to read more about the installation process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try gatsbyjs.org/packages/gatsby-source-cloudinary/ instead of the NPM page