What is cloudinary?
The Cloudinary npm package provides a comprehensive suite of tools for managing and manipulating media assets in the cloud. It allows developers to upload, transform, optimize, and deliver images and videos efficiently.
What are cloudinary's main functionalities?
Upload
This feature allows you to upload images and videos to Cloudinary. The code sample demonstrates how to configure the Cloudinary client and upload an image.
const cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: 'your_cloud_name',
api_key: 'your_api_key',
api_secret: 'your_api_secret'
});
cloudinary.uploader.upload('path/to/your/image.jpg', function(error, result) {
console.log(result, error);
});
Transformation
This feature allows you to transform images and videos, such as resizing, cropping, and applying effects. The code sample demonstrates how to generate a URL for a transformed image.
const cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: 'your_cloud_name',
api_key: 'your_api_key',
api_secret: 'your_api_secret'
});
const url = cloudinary.url('sample.jpg', { width: 300, height: 300, crop: 'fill' });
console.log(url);
Optimization
This feature allows you to optimize images and videos for faster loading times and better performance. The code sample demonstrates how to generate a URL for an optimized image.
const cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: 'your_cloud_name',
api_key: 'your_api_key',
api_secret: 'your_api_secret'
});
const url = cloudinary.url('sample.jpg', { quality: 'auto', fetch_format: 'auto' });
console.log(url);
Delivery
This feature allows you to deliver images and videos via a CDN. The code sample demonstrates how to generate a URL for delivering an image.
const cloudinary = require('cloudinary').v2;
cloudinary.config({
cloud_name: 'your_cloud_name',
api_key: 'your_api_key',
api_secret: 'your_api_secret'
});
const url = cloudinary.url('sample.jpg');
console.log(url);
Other packages similar to cloudinary
imgix
Imgix is a service that provides real-time image processing and optimization. It offers similar functionalities to Cloudinary, such as image transformations, optimizations, and delivery via a CDN. However, Imgix focuses more on real-time image processing and URL-based transformations.
filestack-js
Filestack is a service that provides file uploading, transformation, and delivery. It offers functionalities similar to Cloudinary, including file uploads, transformations, and optimizations. Filestack also provides additional features like file picking and storage integration.
imagekit
ImageKit is a service that provides real-time image optimization, transformation, and delivery. It offers similar functionalities to Cloudinary, such as image transformations, optimizations, and delivery via a CDN. ImageKit also focuses on real-time image processing and URL-based transformations.
Cloudinary Node SDK
About
The Cloudinary Node 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 Node SDK Guide.
Table of Contents
Key Features
Version Support
SDK Version | Node version |
---|
1.x.x | Node@6 & up |
2.x.x | Node@9 & up |
Installation
npm install cloudinary
Usage
Setup
const cloudinary = require('cloudinary').v2
Transform and Optimize Assets
cloudinary.url("sample.jpg", {width: 100, height: 150, crop: "fill", fetch_format: "auto"})
Upload
cloudinary.v2.uploader.upload("/home/my_image.jpg", {upload_preset: "my_preset"}, (error, result)=>{
console.log(result, error);
});
Large/Chunked Upload
cloudinary.v2.uploader.upload_large(LARGE_RAW_FILE, {
chunk_size: 7000000
}, (error, result) => {console.log(error)});
Security options
Contributions
- Ensure tests run locally (add test command)
- Open a PR and ensure Travis tests pass
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
- Cloudinary Transformation and REST API References: Comprehensive references, including syntax and examples for all SDKs.
- MediaJams.dev: Bite-size use-case tutorials written by and for Cloudinary Developers
- DevJams: Cloudinary developer podcasts on YouTube.
- Cloudinary Academy: Free self-paced courses, instructor-led virtual courses, and on-site courses.
- Code Explorers and Feature Demos: A one-stop shop for all code explorers, Postman collections, and feature demos found in the docs.
- Cloudinary Roadmap: Your chance to follow, vote, or suggest what Cloudinary should develop next.
- Cloudinary Facebook Community: Learn from and offer help to other Cloudinary developers.
- Cloudinary Account Registration: Free Cloudinary account registration.
- Cloudinary Website: Learn about Cloudinary's products, partners, customers, pricing, and more.
Licence
Released under the MIT license.