Skip to content

Latest commit

 

History

608 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build status NuGet Badge NuGet Downloads License

Cloudinary .NET SDK

About

The Cloudinary .NET SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize, transform, upload and manage your cloud's assets.

Note

This Readme provides basic installation and usage information. For the complete documentation, see the .NET SDK Guide.

Table of Contents

Key Features

Version Support

SDK Version .NET Framework 4.5.2 - 4.8 .NET Standard 1.3 and up .NET Core .NET 5 - 9
1.x ✔ ✔ ✔ ✔

Installation

CloudinaryDotNet is available as NuGet package CloudinaryDotNet

Install using Package Manager:

PM> Install-Package CloudinaryDotNet

Or using the .NET CLI:

dotnet add package CloudinaryDotNet

Usage

Setup

using CloudinaryDotNet;
using CloudinaryDotNet.Actions;

var cloudinary = new Cloudinary();   // reads the CLOUDINARY_URL environment variable
cloudinary.Api.Secure = true;        // generate https:// URLs

Note that Api.Secure defaults to false, so set it unless you specifically want http:// URLs.

Transform and Optimize Assets

var url = cloudinary.Api.UrlImgUp.Transform(new Transformation().Width(100).Height(150).Crop("fill")).BuildUrl("sample.jpg")

Upload

var uploadParams = new ImageUploadParams()
{
    File = new FileDescription(@"c:\mypicture.jpg")
};

var uploadResult = cloudinary.Upload(uploadParams);

Error handling

Cloudinary API errors are returned, not thrown. Check Error on every result:

var uploadResult = await cloudinary.UploadAsync(uploadParams);

if (uploadResult.Error != null)
{
    Console.Error.WriteLine($"Upload failed ({(int)uploadResult.StatusCode}): {uploadResult.Error.Message}");
    return;
}

Console.WriteLine(uploadResult.SecureUrl);

A try/catch around an API call will not catch a Cloudinary error — only configuration and argument problems throw. See docs/troubleshoot-errors.md.

Code Samples

You can find our simple and ready-to-use samples projects, along with documentations in the samples folder.

Please consult with the README file, for usage and explanations.

Task-focused runnable examples live in examples/.

Security options

Documentation for AI coding agents

This package ships task documentation inside the NuGet package, so it always matches the version you have installed. If you are an AI coding agent — or you use one — point it there rather than at training data, which is frequently out of date for this SDK.

Locate the installed copy:

ROOT=$(dotnet nuget locals global-packages --list | awk '{print $2}')
ls "$ROOT"/cloudinarydotnet/*/docs

The same pages are browsable here: docs/ — covering configuration, upload, chunked video upload, signed browser uploads, image and video delivery, search and asset management, moderation, structured metadata, ASP.NET Core integration, and troubleshooting.

Agents contributing to this repository should read AGENTS.md instead.

Contributions

  • Ensure tests run locally (dotnet test CloudinaryDotNet.Tests/CloudinaryDotNet.Tests.csproj -c Release -f net8.0)
  • Open a PR and ensure the CI build passes

See CONTRIBUTING.md for details.

Get Help

If you run into an issue or have a question, you can either:

About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.

Additional Resources

Licence

Released under the MIT license.

Releases

Packages

Used by

Contributors

Languages