SO after a lot of web surfing and in-depth analysis of Meaww and Nametests I found out that they use a third-party tool to host and manipulate images that are Cloudinary .
I answer my question so that any other person who encounters such a problem should not be bothered by many things and testing various third-party libraries that are not related to the problem at all, since I struggled a lot with the same.
Let's first make a few points about Cloudinary
: CloudMan is a cloud service that provides a complete image management solution, including upload, storage, manipulation, optimization, and delivery.
With CloudLine, you can easily upload images to the cloud, automatically perform intelligent manipulations without installing any complex software. All your images are then easily delivered through a fast CDN, optimized, and using industry best practices. CloudMan offers comprehensive APIs and administration capabilities and integrates seamlessly with new and existing web and mobile applications.
Cloudinary
offers an SDK and supports various programming technologies, including .Net, PHP, Java, Rubby
, etc.
There are other services similar to Cloudinary
, such as Blitline , but the good thing about Cloudinary
is that this service is for both programmers and non-programmers. If someone does not have programming experience, he can still use this service. Since it provides users with a very intelligent toolbar.
I think that I have already made too many points, so it's time to work a bit to answer the question.
To deal with the above problem, we need to get the CloudinaryDotNet
nuget package with the following command through the package manager console.
Install - Package CloudinaryDotNet
After installing the Package, we can create our API calls for Cloudinary
services. Note: 1st. We need to make a Cloudinary
account. Fortunately, Cloudinary
offers a free account with no time limit. 2. Set up your Cloudinary
account under the .Net
project.
using CloudinaryDotNet; using CloudinaryDotNet.Actions; Account account = new Account( "my_cloud_name",
Uploading images using Cloudinary: To manage images, images must already be uploaded to your Cloudinary
account. This can be done directly from the Cloudinary
toolbar or programmatically from your web application, as shown below:
var uploadParams = new ImageUploadParams() { File = new FileDescription("File Path or Directly for a URL"), PublicId = "sample_id",// each image on the server should be named differently if this option is not assigned cloudinary will automatically assign one to it. Tags = "Tags for Images", }; var uploadParamsResult= cloudinary.Upload(uploadParams); // this line will upload image to the cloudinary server.
When all of the above is set in place, then managing images with Cloudinary
is simple as:
You can manipulate / transform any image: 1. Positioned on another image. 2. Place an effect similar to sepia. 3. Put text on it and a lot . The following is a simple example:
@Model.Api.UrlImgUp.Transform(new Transformation().Width("700").Height("370") .Effect("sepia").Width("200").Height("200").Crop("thumb").Gravity("face").Radius("max").Overlay("image1").Gravity("west").Y(18).X(20) .Chain().Width("150").Height("150").Crop("fill").Radius("20").Border(4, "#553311").Overlay("image2").Gravity("east").Y(18).X(20)).BuildImageTag("Background_Pic")
And honestly for me that's all.