cloudinary1.14.0 • Public • Published
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.
For Node.js, Cloudinary provides an extension for simplifying the integration even further.
Getting started guide
Take a look at our Getting started guide for Node.js.
npm install cloudinary
Try it right away
Sign up for a free account so you can try out image transformations and seamless image delivery through CDN.
demo in all the following examples with your Cloudinary's
Accessing an uploaded image with the
sample public ID through a CDN:
Generating a 150x100 version of the
sample image and downloading it through a CDN:
Converting to a 150x100 PNG with rounded corners of 20 pixels:
For plenty more transformation options, see our image transformations documentation.
Generating a 120x90 thumbnail based on automatic face detection of the Facebook profile picture of Bill Clinton:
Each request for building a URL of a remote cloud resource must have the
cloud_name parameter set.
Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the
api_secret parameters set. See API, URLs and access identifiers for more details.
api_secret parameters can be done either directly in each call to a Cloudinary method, by calling the cloudinary.config(), or by using the CLOUDINARY_URL environment variable.
Require the Cloudinary library
var cloudinary = v2
Overriding the request agent
To override the request agent pass the agent into any method that makes a request and it will be used instead of the normal https agent. e.g
Embedding and transforming images
Any image uploaded to Cloudinary can be transformed and embedded using powerful view helper methods:
The following example generates the url for accessing an uploaded
sample image while transforming it to fill a 100x150 rectangle:
Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:
You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.
Embedding a Facebook profile to match your graphic design is very simple:
Same goes for Twitter:
See our documentation for more information about displaying and transforming images in Node.js.
Assuming you have your Cloudinary configuration parameters defined (
api_secret), uploading to Cloudinary is very simple.
The following example uploads a local JPG to the cloud:
var cloudinary = v2;cloudinaryuploader;
Below is an example of an upload's result:
The uploaded image is assigned a randomly generated public ID. The image is immediately available for download through a CDN:
You can also specify your own public ID:
See our documentation for plenty more options of uploading to the cloud from your Node.js code or directly from the browser.
You can use cloudinary.upload_stream to write to the uploader as a stream:
var fs = ;var stream = cloudinaryuploader;var file_reader = fs;
Version 1.1 upload_stream change notes
upload_stream method was modified to return a
Transform stream object, we advise to change the
on('end') to pipe API:
var file_reader = fs;
if you still need to use event chanining, you can wrap
stream.end with wrapper functions
var file_reader = fs;
Returns an html image tag pointing to Cloudinary.
cloudinary// <img src='' height='100' width='100'/>
Additional resources are available at:
- Interactive demo
- Knowledge Base
- Documentation for Node.js integration
- Node.js image upload documentation
- Node.js image manipulation documentation
- Image transformations documentation
npm run test
You can open an issue through GitHub.
Contact us https://cloudinary.com/contact
Join the Community
Impact the product, hear updates, test drive new features and more! Join here.
Released under the MIT license.