Cloud Technology

What is Cloudinary in Cloud Computing?

Cloudinary is an easy-to-use service that makes it super fast and easy to upload images from your computer or mobile device to the web.

Hire Dedicated Developers

What is Cloud Computing?

Cloud computing is technical, most of this is in cables under the ocean. But now, you will get the idea.
The internet is synonymous with the cloud. It usually refers to the photo, video, and document storage services like iCloud, OneDrive, and Dropbox that are accessible from anywhere. But cloud computing actually refers to anything that involves delivering services over the internet, as opposed to hardware-software installations on individual devices.
It divides into 3 parts:
Paas: Platform as a service
Iaas: Infrastructure as a service
Saas: Software as a service.

Cloud Computing

 

What is Paas?

Platform as a service is a model in which a third-party provider hosts app development platforms and tools on its own infrastructure available to customers over the internet. Paas models are used for general software development.

What is Iaas?

Infrastructure as a service provider hosts server storage and other individualized resources over the internet.
Iaas offers a variety of storage and memory options for any workload need.

What is Saas?

And most commonly and countered at the consumer level, software as a service, is software distribution from a third party provider, making applications available over the internet like Microsoft office 36, AWS, Productivity, and email. Cloud can be public, selling services to anyone on the internet or private, supplying services to select individuals. Offering includes amazon web services, IBM Cloud, Google cloud platform, and Microsoft Azure.
In the end, all cloud services share the same goal: to provide easy scalable, access to resources and services. Specific benefits include self-provisioning, elasticity, pay for use, workload resilience, and migrations flexibility.

What is Cloudinary?

Cloudinary

Let’s get started with the software as a service provider(Saas), which is Cloudinary. On which we can store the images and videos, and also we can transform them, optimize them and deliver them to the customer via the REST APIs. For doing all of these functionalities, Cloudinary offers its SDK which wraps the APIs which we need to integrate to perform the above functionality as per the user needs.

Steps to API Integration with Cloudinary:

  • Create Account:

For this, you need to create the account on the Cloudinary official platform and go to the dashboard and you will get the below screen.

Create Account

The account details section on the dashboard page shows your cloud name identifier, as well as API key and secret, which we will need in order to configure our SDK or to directly run API requests.
The environment variable combines all of these values and can be copied for quick configuration of your SDK ad other server-side integrations.

  • Install SDK:

For performing the different functionalities, we need to install the package of Cloudinary and set it up for our application. If it’s.net then you can use the below command:
//Add CloudinaryDotNet using Nuget Package Manager or if using Package Manager Console:
Install-Package CloudinaryDotNet
For every SDK, we will need to configure at least the cloud name.
To set up the SDKs at the backend, we need the api_key and api_secret, which will be copied from the account we have.
For all legacy SDKs, we will probably want to set the secure parameter to true to ensure that our transformation URLs are always generated as HTTPS.
If we have a private CDN or CName, we will need to configure those as well, and there are other optional configurations we may want to set.
Here are the basic settings and global configurations options in our SDKs:

Account account = new Account(
"my_cloud_name",
"my_api_key",
"my_api_secret”);


Cloudinary cloudinary = new Cloudinary(account);
cloudinary.Api.Secure = true;
  • Upload functionalities:

Cloudinary offers a variety of options for programmatically uploading assets to our account from our application.
Upload API: Implement our own upload functionality with the upload method of the Upload API. This method can be called directly from within our own custom code or by using one of the Cloudinary SDKs that wrap the REST API and greatly simplify the implementation. We also have the option to upload the resources directly to Cloudinary(bypassing our servers) with unsigned uploads.
The following simple example shows the single line of code needed to upload an image from the remote URL https://www.learningcenter.com.sample.jpg, and set its public_id(identifier) as sample_woman using any of our backend SDKs or the REST API:

var uploadParams = new ImageUploadParams()
{
File = new FileDescription(@"https://www.example.com/mysample.jpg"),
PublicId = "sample_woman"
};
var uploadResult = cloudinary.Upload(uploadParams);

The uploaded file can be seen in our created account on the Media Library screen:

 

Also, we can create upload the image to the specific folders in our account like this:

var uploadParams = new ImageUploadParams()
{
Folder = “sample/animals/”,
File = new FileDescription(@"threedogs.jpg"),
PublicId = "sample_woman",
Overwrite = true
};
var uploadResult = cloudinary.Upload(uploadParams);
  • Image and video transformations:

By adding transformation parameters to and mage or video URL, we can apply a huge variety of automatic adjustments and effects to our delivered media
For example:
Using on-the-fly transformations parameters directly in the image URL, we could deliver the image with the following changes automatically applied:
Generate a 200*200px square thumbnail of the largest face in the image (w_200,h_200,c_thumb,g_face).
Round the corners with radius of 20px(r_20).
Add a 5 pixel wide black border(bo_5px_solid_black).
Add the cloudinary icon white image as an overlay, scaled to 25% of the width of the man image, placed 10px away from the northest corner, and with 50% opacity(l_cloudinary_icon_white,o_50,w_0.25,fl_relative,g_north_east,y_10,x_10).
Deliver as a png to enable transparency around the rounded corners.

cloudinary.Api.UrlImgUp.Transform(new Transformation()
.Gravity("face").Height(200).Width(200).Crop("thumb").Chain()
.Border("5px_solid_black").Radius(20).Chain()
.Overlay(new Layer().PublicId("cloudinary_icon_white")).Chain()
.Flags("relative").Width(0.25).Crop("scale").Chain()
.Opacity(50).Chain()
.Flags("layer_apply").Gravity("north_east").X(10).Y(10)).BuildImageTag("sample_woman.png")

Conclusion:

In Conclusion, We’ve taken the most significant step to integrate Cloudinary programmable media capabilities into our app. I’ve answered many of the essential questions needed to make the most of Cloudinary.

Reference :
https://cloudinary.com/documentation/upload_images

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply