In this article, we will learn how we can display image in responsive device using cloudinary plugin.
Before that we will take an overview of what is cloudinary. It is a plugin which help us to transform our images based on the device. There are many other functionalities which is provided by this plugin, we use the media optimizer one. You can check the media optimizer cloudinary products here Media Optimizer: Digital Media Optimization – Automated (cloudinary.com)
Let’s Start by creating an account in cloudinary. It has a free signup. Once you login into the system, we can upload the image by creating new folder under the media library option from the menu
We can upload images using the upload button from the portal or using the API provided by Cloudinary. You can check the blog here How To Upload Images Using Cloud nary In ASP.Net MVC – The Code Hubs to upload the image using c#
Once we upload the image we need to add it html like below. Also, we have to add the js file given by cloudinary.
Note: cloud_name is the name of the cloud of our account. we can find it in the portal next to the profile icon.
We have to add the cloudinary image url as data-src. To make the image responsive as per the device, we need to add width as auto. For that, we added w_auto in the url.
To manage the quality of the image, we use q_auto and f_auto is to handle the image format. For optimization of image format and quality matter a lot.
Here is the video for the result