All Projects → cloudinary → Cloudinary_npm

cloudinary / Cloudinary_npm

Cloudinary NPM for node.js integration

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Cloudinary npm

Cdn
CDN is a Just-in-time asset manipulation and delivery application, providing a complete content distribution/delivery solution
Stars: ✭ 192 (-57.33%)
Mutual labels:  image-manipulation, cdn
Imgp
📸 High-performance cli batch image resizer and rotator
Stars: ✭ 744 (+65.33%)
Mutual labels:  image-manipulation, image-compression
Image Resizer
On-the-fly image resizing using Node.js and libvips. Heroku Ready!
Stars: ✭ 59 (-86.89%)
Mutual labels:  image-compression, cdn
Imageflow
High-performance image manipulation for web servers. Includes imageflow_server, imageflow_tool, and libimageflow
Stars: ✭ 3,643 (+709.56%)
Mutual labels:  image-manipulation, image-compression
wrender
Image compression and transformation reverse-proxy for Express apps
Stars: ✭ 14 (-96.89%)
Mutual labels:  cdn, responsive-images
uploadcare-ios
UploadcareKit: iOS SDK for Uploadcare API
Stars: ✭ 24 (-94.67%)
Mutual labels:  cdn, image-manipulation
Cloudinary React
React components that utilize Cloudinary functionality
Stars: ✭ 427 (-5.11%)
Mutual labels:  web-development, image-manipulation
auto-cloudinary
Super simple Cloudinary auto-upload implementation for WordPress.
Stars: ✭ 34 (-92.44%)
Mutual labels:  cdn, image-manipulation
Cdndrive
☁️ CDNDrive = BiliDrive + SuperBed,支持任意文件的全速上传与下载
Stars: ✭ 310 (-31.11%)
Mutual labels:  cloud, cdn
Imager Craft
This plugin has been DEPRECATED. Check out Imager X instead.
Stars: ✭ 351 (-22%)
Mutual labels:  image-manipulation, responsive-images
Lena.js
👩 Library for image processing
Stars: ✭ 432 (-4%)
Mutual labels:  image-manipulation
Npm Run All
A CLI tool to run multiple npm-scripts in parallel or sequential.
Stars: ✭ 4,496 (+899.11%)
Mutual labels:  npm-package
Wasm Imagemagick
Webassembly compilation of https://github.com/ImageMagick/ImageMagick & samples
Stars: ✭ 442 (-1.78%)
Mutual labels:  image-manipulation
Shiny
Easy interactive web applications with R
Stars: ✭ 4,507 (+901.56%)
Mutual labels:  web-development
Model server
A scalable inference server for models optimized with OpenVINO™
Stars: ✭ 431 (-4.22%)
Mutual labels:  cloud
Practical Deep Learning Book
Official code repo for the O'Reilly Book - Practical Deep Learning for Cloud, Mobile & Edge
Stars: ✭ 441 (-2%)
Mutual labels:  cloud
Openpbs
An HPC workload manager and job scheduler for desktops, clusters, and clouds.
Stars: ✭ 427 (-5.11%)
Mutual labels:  cloud
Generative Compression
TensorFlow Implementation of Generative Adversarial Networks for Extreme Learned Image Compression
Stars: ✭ 428 (-4.89%)
Mutual labels:  image-compression
React Starter Kit
React Starter Kit — front-end starter kit using React, Relay, GraphQL, and JAM stack architecture
Stars: ✭ 21,060 (+4580%)
Mutual labels:  cdn
Front End Handbook 2018
2018 edition of our front-end development handbook
Stars: ✭ 4,172 (+827.11%)
Mutual labels:  web-development

Build Status

Cloudinary

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.

Setup

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.

Note: Replace demo in all the following examples with your Cloudinary's cloud name.

Accessing an uploaded image with the sample public ID through a CDN:

http://res.cloudinary.com/demo/image/upload/sample.jpg

Sample

Generating a 150x100 version of the sample image and downloading it through a CDN:

http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg

Sample 150x100

Converting to a 150x100 PNG with rounded corners of 20 pixels:

http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png

Sample 150x150 Rounded PNG

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:

http://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg

Facebook 90x120

For more details, see our documentation for embedding Facebook and Twitter profile pictures.

Usage

Configuration

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_key and api_secret parameters set. See API, URLs and access identifiers for more details.

Setting the cloud_name, api_key and 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 = require('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

cloudinary.uploader.upload_stream(
  { agent: myAgent },
  function(error, result) { console.log(result); }
);

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:

cloudinary.url("sample.jpg", {width: 100, height: 150, crop: "fill"})

Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:

cloudinary.url("woman.jpg", {width: 90, height: 90, crop: "thumb", gravity: "face"});

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:

cloudinary.url("billclinton.jpg", {width: 90, height: 130, type: "facebook", crop: "fill", gravity: "north_west"});

Same goes for Twitter:

cloudinary.url("billclinton.jpg", {type: "twitter_name"});

See our documentation for more information about displaying and transforming images in Node.js.

Upload

Assuming you have your Cloudinary configuration parameters defined (cloud_name, api_key, api_secret), uploading to Cloudinary is very simple.

The following example uploads a local JPG to the cloud:

var cloudinary = require('cloudinary').v2;
cloudinary.uploader.upload("my_picture.jpg", function(error, result) { console.log(result) });

Below is an example of an upload's result:

{
  "public_id": "4srvcynxrf5j87niqcx6w",
  "version": 1340625837,
  "signature": "01234567890abcdef01234567890abcdef012345",
  "width": 200,
  "height": 200,
  "format": "jpg",
  "resource_type": "image",
  "url": "http://res.cloudinary.com/demo/image/upload/v1340625837/4srvcynxrf5j87niqcx6w.jpg",
  "secure_url": "https://res.cloudinary.com/demo/image/upload/v1340625837/4srvcynxrf5j87niqcx6w.jpg"
}

The uploaded image is assigned a randomly generated public ID. The image is immediately available for download through a CDN:

cloudinary.url("abcfrmo8zul1mafopawefg.jpg");

// http://res.cloudinary.com/demo/image/upload/abcfrmo8zul1mafopawefg.jpg

You can also specify your own public ID:

cloudinary.uploader.upload(
  "http://www.example.com/image.jpg", 
  {public_id: 'sample_remote'}, 
  function(error, result) { 
    console.log(result) 
  }
);

cloudinary.url("sample_remote.jpg")

// http://res.cloudinary.com/demo/image/upload/sample_remote.jpg

See our documentation for plenty more options of uploading to the cloud from your Node.js code or directly from the browser.

cloudinary.upload_stream

You can use cloudinary.upload_stream to write to the uploader as a stream:

var fs = require('fs');
var stream = cloudinary.uploader.upload_stream(function(error, result) { console.log(result); });
var file_reader = fs.createReadStream('my_picture.jpg', {encoding: 'binary'}).on('data', stream.write).on('end', stream.end);

Version 1.1 upload_stream change notes

The upload_stream method was modified to return a Transform stream object, we advise to change the on('data') and on('end') to pipe API:

var file_reader = fs.createReadStream('my_picture.jpg').pipe(stream);

if you still need to use event chanining, you can wrap stream.write and stream.end with wrapper functions

var file_reader = fs.createReadStream('my_picture.jpg', {encoding: 'binary'})
  .on('data', function(data){stream.write(data)})
  .on('end', function(){stream.end()});

cloudinary.image

Returns an html image tag pointing to Cloudinary.

Usage:

cloudinary.image("sample", {format: "png", width: 100, height: 100, crop: "fill"})

// <img src='http://res.cloudinary.com/demo/image/upload/c_fill,h_100,w_100/sample.png' height='100' width='100'/>

Typescript

🎉New 🎉TypeScript support was just added. Check out the declaration file.

Samples

You can find our simple and ready-to-use samples projects, along with documentation in the samples folder. Please consult with the README file, for usage and explanations.

Additional resources

Additional resources are available at:

Run test

npm run test

Node support

This SDK requires node >= 8.

Support

You can open an issue through GitHub.

Contact us https://cloudinary.com/contact

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

Join the Community

Impact the product, hear updates, test drive new features and more! Join here.

License

Released under the MIT license.

Test resources include the video Cloud Book Study which was created by Heidi Neilson and is distributed under the Creative commons - attribution license (CC BY 3.0)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].