Cloudinary Blog

How the Cloudinary-Magento 2 plugin can optimize performance and your bottom line

Magento Image Optimization with the Cloudinary Plugin

Cloudinary has teamed up with Inviqa, a selected partner of Cloudinary, on creating a module to help Magento 2 users benefit from everything Cloudinary has to offer. Here Rick Peacock, with the help of Paal Soberg, a senior software engineer at Inviqa, takes a closer look at the new plugin.

The Cloudinary Magento module – available since 2014 – makes it easy for Magento shop owners and Magento developers to benefit from Cloudinary's services. The plugin links your Magento website to your Cloudinary account, allowing your teams to manage and automatically serve all your product, category, and content management system (CMS) images directly from Cloudinary.

To help Magento users get even more value from the plugin, Cloudinary recently teamed up with Inviqa. We worked together to further improve the plugin’s performance and usability, make upload operations more resilient to network issues, provide upload alternatives for sites without a Cron setup, and to allow sites to use Cloudinary transformations to apply creative effects to their images.

But we also wanted to ensure that users of Magento’s latest platform – Magento 2 – had full access to Cloudinary’s services. That was the thinking behind our dedicated Magento 2 module.

Note
Cloudinary Partners with Magento to Improve the Visual Shopping Experience for eCommerce. Read more here.

Why Cloudinary for your Magento store?

There's no doubt that images, and more recently also videos, take center stage for most e-commerce sites, and are essential for bringing in, and keeping customers. But ironically, these images and videos are also the main culprits slowing down your page load time. And it's a known fact that slower page load times equate directly to nasty impacts on conversion rate, bounce rate, and session lengths:

Magento infographic
From: Akamai's Spring 2017 Online Retail Performance report

So it follows that you should be doing everything in your power to deliver your images and videos in the most optimized way possible.

Cloudinary is a backend cloud service for image and video media. Among its specialties is delivering automatically optimized images and videos via fast content delivery networks, to ensure that every media file that is delivered to each user's browser or mobile phone is as small as possible while maintaining the desired quality level. Cloudinary also offers valuable features such as face-detection-based cropping, automatic color replacement and a whole selection of other powerful image and video manipulation capabilities.

Cloudinary is generally targeted at Web developers, but the dedicated Cloudinary Magento module has been designed so that non-technical Magento users can easily 'plug-and-play' these capabilities into their store and enjoy those essential optimizations and other features, with no coding required! But web and mobile developers can still dive in and take advantage of the full power of all Cloudinary features or even fork/clone the open-source Cloudinary Magento plug-in and customize it to their heart's content.

So let’s take a look at what the Cloudinary Magento 2 module offers.

Installing and configuring the module

As with the legacy Cloudinary Magento plugin, the Magento 2 plugin is very simple and streamlined. Just download the module from the Magento Marketplace. Once installed, enter your Cloudinary account details into the module configuration page, and set a few preferences, or keep the default settings.

Migrating your media to Cloudinary

The average Magento store tends to have hundreds, or maybe thousands of images, many of which are in high resolution since the goal is to show products in the best-possible detail – especially when viewed using a magnifier widget.

To take advantage of Cloudinary's capabilities, you’ll first need to upload all your shop images to your Cloudinary account so they can be optimized and served by Cloudinary’s super-fast content delivery network (CDN).

A manual upload would be problematic to scale for any site with many images, and risks issues of web server timeouts, network glitches, etc. To address this, the Magento 1 Cloudinary module offered a background process to handle bulk image migration, but setting this up and validating the process is more technically complex.

What if there was a way of skipping the bulk migration entirely?

There is!

New auto-upload mapping

You can now avoid manual migrations and the complex process of background bulk migration using the new auto-upload mapping feature.

In the Cloudinary Module Configuration, just switch on the auto-upload option, hit save, and that's it! Your images are uploaded to Cloudinary automatically upon request, and most importantly, with no downtime. Each individual image in your store continues to be served via Magento until successfully migrated to Cloudinary, and then Presto! The new, optimized image comes through.

We recommend using the new auto-upload feature for all Magento sites. There is no migration process to handle, images are lazy-loaded on-demand, so no demand spikes will hit your web server, and synchronization between Magento images and Cloudinary is handled automagically. Furthermore, using this mode does not require any checks to see which images have been uploaded to Cloudinary, so database lookups are avoided. This can be significant, especially for high-traffic sites with many category pages and images.

Performance

The big 'P'. This is what it's all about. We know the performance of your Magento site is critical to your success. That's why the Cloudinary module includes an impressive set of performance improvements to shave those precious seconds and milliseconds off your page load times:

Automatic image format optimization

When this option is enabled (default), Cloudinary analyzes each image, determines which image format will give the smallest file size with the best quality, converts the image to that format, and then serves the image. All instantly and automatically! What’s more, Cloudinary even detects which image is best for the particular browser your customer is using, serving WebP to Chrome browsers or JPEG-XR to Internet Explorer.

Image format optimization is also safe to use with images that have alpha transparency since Cloudinary automatically checks whether an image has any transparent areas, and ensures the format it serves can maintain the transparency.

Automatic image quality

You always want to deliver your images at a quality that will invite them to look closer and get the best possible impression of your products. But in almost all cases, it's possible to deliver an image at a resolution significantly lower than the original professional photograph, without any quality reduction that would be visible to the human eye.

The problem is that the amount you can compress or otherwise adjust any image without sacrificing the required level of quality differs significantly from image to image.

Luckily, Cloudinary has a sophisticated automatic quality algorithm that analyzes each image to find the best quality compression level and optimal encoding settings based on the specific content of that image. Cloudinary automates this file size versus quality trade-off decision, on-the-fly, using perceptual metrics and heuristics to make precise adjustments of the compression level, complemented by fine-tuning of the encoding settings. The result is a significantly reduced file size without any noticeable degradation.

Additional optimizations

Whenever you apply any format or quality optimizations to Cloudinary images, Cloudinary also automatically performs other optimizations to reduce file size, such as stripping unnecessary metadata from photos and applying other optimization algorithms.

Additionally, when you apply both automatic quality and automatic format optimizations, the two settings work together to achieve a result that's even better than the sum of the two parts.

So what does this mean?

All these processes make significant savings to image sizes, and therefore reduce page loading times for customers. That means you can be certain your images are of the optimal size and quality no matter what format the originals are in, completely automatically!

New image transformation features

With the new image transformation features, Magento stores can now leverage powerful chained transformations to process images in any way imaginable.

Cloudinary has a vast array of effects, shape modifications, enhancements, cropping, and overlays. What makes these even more powerful is the ability to chain each process to create truly unique enhancements.

Default image transformation

Say your site has changed to a theme that requires all images to be displayed with rounded corners to a radius of 30 pixels. Editing your images one by one is going to be very time consuming, but Cloudinary has a better way.

You can easily apply rounded corners globally to all your images using a default transformation. To get the effect on your store images, just head to the Cloudinary module configuration page, enter ‘r_30’ in the ‘Default Image Transformations’ section. and press the preview button to review the effect before anything is changed on your store. Looks good? Hit ‘Save’ and the effect will be applied to all images managed by Cloudinary.

image with rounded corner

This is a great way to improve the look of your entire site or give it a unique touch without requiring tedious manual edits.

Of course, you might sometimes want to apply a special effect or transformation to a specific image. To do this, select the Cloudinary tab on the Product Admin page to see all the images for that product, select the image you want and enter the transformations required. Then hit ‘preview’ to test the effect before saving.

This can be a great way to add overlays to your images, say special-offer logos, without the headache of configuring formats, sizes, and adjusting quality for web optimization!

For details on all available image transformations, have a look at the Image Transformation Guide and Reference in the Cloudinary documentation.

Delivering video with Cloudinary

Magento 2 added the option to embed videos in your store pages. By default, Magento supports delivering via YouTube or Vimeo URLs. But if you use Cloudinary, you can upload your videos to your Cloudinary Media Library and supply a Cloudinary video URL instead. This enables you to take advantage of all the video transcoding and manipulation capabilities of the Cloudinary video solution.

The bottom line -- literally

With Cloudinary, any Magento site owner can look forward to improved site performance, which directly translates into an improved turnover. Use the Cloudinary module to simplify image and video management and open up creative options for pain-free image transformations.

For more details, head over to the Cloudinary Magento module page on Magento Marketplace.

Rick Peacock is a senior software engineer at Inviqa, a technology partner and consultancy specialised in ecommerce, content management solutions, and custom software development. Get in touch to explore how we can support your digital journey.

Recent Blog Posts

Cloudinary Product Gallery Enables Dynamic Buyer Experience

We live in a world where we spend increasingly more time online. As our routines change and adapt to new trends and technologies, we perform more and more of our daily activities in virtual environments. A key example of this is shopping. There are many reasons why online shopping has become so attractive for many buyers. A near endless variety of products is accessible from the palm of your hand. Customer reviews give buyers more confidence in their decisions. It's increasingly easy to search for attractive prices. And the list goes on. But a customer's desire to "touch" or "feel" the product is an interactive experience that can be hard to overcome when shopping online.

Read more
A Guide to Website Image Optimization and Performance

Part 1 of this series delves into the background for this guide. Here in part 2 are the ins and outs.

Wait, hear me out. I know, we just talked about this: Nobody is sheepishly pleading you, “Please, might we have just one more image on the page?” No, I’m not telling you to pick that particular fight. Instead, use a little smoke and mirrors to avoid requests for images that your audience needn’t render right away and might never need at all while loading them asynchronously—only as needed.

Read more
A Guide to Image Optimization for Website Performance

I’ve spent a lot of time thinking about the rules of putting images on the web.

For such a flexible medium as the web, software development can feel like a painstaking, rules-oriented game—an errant comma might break a build, a missing semicolon might wipe out an entire page. For a long time, the laws of image rendering seemed similarly cut-and-dry: For example, if your markups contained an img element , the singular content of its src attribute would be foisted on the audience regardless of their browsing context, period.

Read more
Digital Asset Management Platform: Meeting Customer Expectations

Consumers today expect media-rich experiences. No longer a novelty, it’s second nature to swipe through multiple photos on mobile apps, zoom in on product images for a closer look, visualize online travel reviews, socialize cool video clips while browsing, and encounter brand messages when walking into brick-and-mortar stores. These experiences weave together visual cues and clues with relevant content to create meaning and more authentic connections for customers.

Read more
How to Customize Cloudinary's eCommerce Android App

Recently we added the Cloudinary Demo - eCommerce App to the Google Play Store. This app demonstrates the best practices for optimal delivery of images on a storefront, including category pages, product pages, and a shopping cart. At the time, we published Introducing the Cloudinary Demo Android App, Part 1, which provided an under-the-hood tour of how the eCommerce Android App was designed and how Cloudinary was integrated throughout.

Read more