Cloudinary JavaScript library
CSS JavaScript CoffeeScript Other
Latest commit 4982457 Mar 27, 2017 @tocker tocker Version 2.3.0
Failed to load latest commit information.
html Set innerText and textContent without using hasOwnProperty, in order … Sep 1, 2015
js Version 2.3.0 Mar 27, 2017
samples Add webpack example. Feb 16, 2016
src Version 2.3.0 Mar 27, 2017
template Remove date and version information from the docs template. Mar 15, 2017
test Add tests for gravity modes. Mar 27, 2017
types Add TypeScript typings for cloudinary-core (#122) Mar 26, 2017
.gitignore Add TypeScript typings for cloudinary-core (#122) Mar 26, 2017
.jshintrc Increment version to v1.0.14: Support dynamically creating an unsigne… Apr 15, 2014
.travis.yml Fix configuration to run on Travis Jun 30, 2016 Version 2.3.0 Mar 27, 2017 Add TypeScript typings for cloudinary-core (#122) Mar 26, 2017
LICENSE.txt Add license file Jul 17, 2016 Remove redundant script tags. Mar 27, 2017 Move tags to separate folder. Add Aug 25, 2015
bower.json Version 2.3.0 Mar 27, 2017
cloudinary.jquery.json Update version to 1.0.25 Sep 1, 2015
jsdoc-conf.json Add format to documentation task. Fix documentation. Remove headers a… Oct 27, 2015 Change client hints behavior. Fixes #107. Remove dependency on 'jquer… Oct 26, 2016 Change client hints behavior. Fixes #107. Remove dependency on 'jquer… Oct 26, 2016 Change client hints behavior. Fixes #107. Remove dependency on 'jquer… Oct 26, 2016 Version 2.1.0 Jun 22, 2016
package.json Version 2.3.0 Mar 27, 2017
tsconfig.json Add TypeScript typings for cloudinary-core (#122) Mar 26, 2017

Build Status npm Bower license

Cloudinary Client Side JavaScript Library

Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.

Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more.

Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.

Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.

Getting started guide

Take a look at our Getting started guide for jQuery.

New API!

The version 2.0.0 release refactors the Cloudinary JavaScript library, and the biggest news is that the newly introduced Core Library is jQuery-independent. The source code has been converted into CoffeeScript and rearranged into classes, and a new build script based on Grunt has been added. The build process produces 3 artifacts:

Github Repository Package name Description
pkg-cloudinary-core cloudinary-core Core Cloudinary Library.
Use this if you do not intend to use jQuery.
pkg-cloudinary-jquery cloudinary-jquery Core Library + jQuery plugin
pkg-cloudinary-jquery-file-upload cloudinary-jquery-file-upload Core Library + jQuery plugin
+ Blueimp File Upload adapter

The same package names are used in both bower and NPM.

Backward compatibility

The cloudinary-jquery-file-upload library is fully backwards compatible with the cloudinary_js library v1.0.25. The relevant Blueimp files can still be found in the js folder for backward compatibility. If you rely on the Blueimp files located in the repository’s js folder, make sure to update your links to load-image.all.min.js which replaces load-image.min.js from previous versions. However, we encourage developers to use a dependency manager such as bower or NPM to install the 3rd party libraries, and not to rely on the files in the js folder.


The following instructions detail the installation of the Cloudinary jQuery File Upload library. For installation instructions of the core library which is not dependent on jQuery follow this link


  1. Install the files using the following command. Use the optional --save parameter if you wish to save the dependency in your bower.json file.

    bower install cloudinary-jquery-file-upload
  2. Include the javascript file in your HTML. For Example:

    <script src="bower_components/jquery/dist/jquery.js"                                          type="text/javascript"></script>
    <script src="bower_components/blueimp-file-upload/js/vendor/jquery.ui.widget.js"              type="text/javascript"></script>
    <script src="bower_components/blueimp-file-upload/js/jquery.iframe-transport.js"              type="text/javascript"></script>
    <script src="bower_components/blueimp-file-upload/js/jquery.fileupload.js"                    type="text/javascript"></script>
    <script src="bower_components/cloudinary-jquery-file-upload/cloudinary-jquery-file-upload.js" type="text/javascript"></script>


The following instructions describe the installation of the client-side libraries. For the server side NodeJS library, see

  1. Install the files using the following commands. Use the optional --save parameter if you wish to save the dependency in your package.json file.

    npm install jquery
    npm install blueimp-file-upload
    npm install cloudinary-jquery-file-upload
  2. Include the javascript file in your HTML. For Example:

    <script src="node_modules/jquery/dist/jquery.js"                                          type="text/javascript"></script>
    <script src="node_modules/blueimp-file-upload/js/vendor/jquery.ui.widget.js"              type="text/javascript"></script>
    <script src="node_modules/blueimp-file-upload/js/jquery.iframe-transport.js"              type="text/javascript"></script>
    <script src="node_modules/blueimp-file-upload/js/jquery.fileupload.js"                    type="text/javascript"></script>
    <script src="node_modules/cloudinary-jquery-file-upload/cloudinary-jquery-file-upload.js" type="text/javascript"></script>


In order to properly use this library you have to provide it with a few configuration parameters:


  • cloud_name - The cloudinary cloud name associated with your Cloudinary account.


  • private_cdn, secure_distribution, cname, cdn_subdomain - Please refer to Cloudinary Documentation for information on these parameters.

To set these configuration parameters use the Cloudinary::config function (see below).


When loading the jQuery Cloudinary library directly (using a script tag), the library automatically converts the relevant fileupload tags to utilize the upload functionality. If jquery.cloudinary is loaded as an AMD however, you need to initialize the Cloudinary fileupload fields e.g., by calling $("input.cloudinary-fileupload[type=file]").cloudinary_fileupload();


The following blog post details the process of setting up a jQuery based file upload.

The Cloudinary Documentation can be found at:

JavaScript Cloudinary objects library

The Cloudinary JavaScript library API reference can be found at:

The Cloudinary JavaScript library provides several classes, defined under the "cloudinary" domain.


Start by instantiating a new Cloudinary class:

var cl = { cloud_name: "demo"});
Using the config function
// Using the config function
var cl =;
cl.config( "cloud_name", "demo");
From meta tags in the current HTML document

When using the library in a browser environment, you can use meta tags to define the configuration options.

The init() function is a convenience function that invokes both fromDocument() and fromEnvironment().

For example, add the following to the header tag:

<meta name="cloudinary_cloud_name" content="demo">

In your JavaScript source, invoke fromDocument():

var cl =;
// or
From environment variables

When using the library in a backend environment such as NodeJS, you can use an environment variable to define the configuration options.

Set the environment variable, for example:

export CLOUDINARY_URL=cloudinary://demo

In your JavaScript source, invoke fromEnvironment():

var cl =;
// or

URL generation

// ""

cl.url( "sample", { width: 100, crop: "fit"})
// ",w_100/sample"

HTML tag generation

You can generate HTML tags in several ways:

Cloudinary::image() generates a DOM tag, and prepares it for responsive functionality. This is the same functionality as $.cloudinary.image(). (When using the Cloudinary jQuery plugin, the src-cache data attribute is stored using jQuery's data() method and so is not visible.)



<img src="http:​/​/​​demo/​image/​upload/​sample" data-src-cache="http:​/​/​​demo/​image/​upload/​sample">​

You can generate an image Tag using the imageTag function:

var tag = cl.imageTag("sample");

which produces:

<img src="">



which produces:

<img src=",w_100/sample">

You can also use ImageTag independently:

var tag = "sample", { cloud_name: "some_other_cloud" });

which produces:

<img src="">


In addition to using a plain object to define transformations or using the builder methods (both described above), you can define transformations by using the Transformation class:

var tr =;
// "c_fit,w_100"

You can also chain transformations together:

var tr =;
// "c_fit,w_10/a_15"

jQuery plugin

The Cloudinary jQuery plugin is fully backward compatible with the previous cloudinary_js version. Under the hood, the new JavaScript library instantiates a CloudinaryJQuery object and attaches it to jQuery.

  • $.cloudinary.config(parameter_name, parameter_value) - Sets parameter_name's value to parameter_value.

  • $.cloudinary.url(public_id, options) - Returns a cloudinary URL based on your configuration and the given options.

  • $.cloudinary.image(public_id, options) - Returns an HTML image tag for the photo specified by public_id

  • $.cloudinary.facebook_profile_image, $.cloudinary.twitter_profile_image, $.cloudinary.twitter_name_profile_image, $.cloudinary.gravatar_image , $.cloudinary.fetch_image - Same as image but returns a specific type of image.

  • $(jquery_selector).cloudinary(options) - Goes over the elements specified by the jQuery selector and changes all the images to be fetched using Cloudinary's CDN. Using the options parameter, you can also specify transformations to the images which use similar syntax across all cloudinary frameworks. Please refer to jQuery image manipulation for a more complete reference regarding the options.

See our documentation for more information about displaying and transforming images using jQuery.

Direct file upload with backend support

The javascript library implements helpers to be used in conjunction with the backend cloudinary frameworks (Rails, PHP, django). These frameworks can be used to embed a file upload field in the HTML (cl_image_upload_tag). When used, the script finds these fields and extends them as follows:

  • Upon a successful image upload, the script will trigger a jQuery event (cloudinarydone) on the input field and provide a fileupload data object (along with the result key containing received data from the cloudinary upload API) as the only argument.
  • If a cloudinary-field-name has been provided with the upload field, the script will find an input field in the form with the given name and update it post-upload with the image metadata: <image-path>#<public-id>.
  • If no such field exists a new hidden field will be created.

See our documentation with plenty more options for uploading to the cloud directly from the browser.

Client side image resizing before upload

See the File Processing Options in Modify your script tags based on the the following example (order is important!):

<script src="bower_components/jquery/dist/jquery.js" type="text/javascript"></script>
<script src="bower_components/jquery.ui/ui/widget.js" type="text/javascript"></script>
<script src="bower_components/blueimp-load-image/js/load-image.all.min.js"></script>
<script src="bower_components/blueimp-canvas-to-blob/js/canvas-to-blob.min.js"></script>
<script src="bower_components/blueimp-file-upload/js/jquery.iframe-transport.js" type="text/javascript"></script>
<script src="bower_components/blueimp-file-upload/js/jquery.fileupload.js" type="text/javascript"></script>
<script src="bower_components/blueimp-file-upload/js/jquery.fileupload-process.js"></script>
<script src="bower_components/blueimp-file-upload/js/jquery.fileupload-image.js" type="text/javascript"></script>
<script src="bower_components/blueimp-file-upload/js/jquery.fileupload-validate.js"></script>
<script src="bower_components/cloudinary-jquery-file-upload/cloudinary-jquery-file-upload.js" type="text/javascript"></script>

Also, add the following javascript:

$(document).ready(function() {
    disableImageResize: false,
    imageMaxWidth: 800,                           // 800 is an example value
    imageMaxHeight: 600,                          // 600 is an example value
    maxFileSize: 20000000,                        // 20MB is an example value
    loadImageMaxFileSize: 20000000,               // default is 10MB
    acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp|ico)$/i

Angular Directives

Joshua Chaitin-Pollak contributed AngularJS directives for Cloudinary: Display and manipulate images and perform uploads from your Angular application.

The Angular module is currently maintained as a separate GitHub project:

Additional resources

Additional resources are available at:


You can open an issue through GitHub.

Contact us at

Stay tuned for updates, tips and tutorials: Blog, Twitter, Facebook.


Released under the MIT license.

The direct image upload feature of the plugin is based on