Cloudinary.uploadImage()

Upload image on Cloudinary (using streams).

Usage

Hover over inputs/exits for more info.

var Cloudinary = require('machinepack-cloudinary');


// Upload image on Cloudinary (using streams).

Cloudinary.uploadImage({

cloudName: 'abc',

apiKey: 'abcd',

apiSecret: 'abcd',

fieldName: '/users/app/.upload/image.png',

imageOptions: {},

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

cloudName required

Your Cloudinary cloud name key.

'abc'
apiKey required

Your Cloudinary API key.

'abcd'
apiSecret required

Your Cloudinary secret API key.

'abcd'
fieldName

Name of the field for uploading the file. Default: file

'/users/app/.upload/image.png'
imageOptions

Cloudinary options for converting the image before saving it to Cloudinary (ex: crop, width, height, etc.)

{}

Exits

error

An unexpected error occurred.

success

OK.

[ { public_id: 'cr4mxeqx5zb8rlakpfkg',
    version: 1372275963,
    signature: '63bfbca643baa9c86b7d2921d776628ac83a1b6e',
    width: 864,
    height: 576,
    format: 'jpg',
    resource_type: 'image',
    created_at: '2013-06-26T19:46:03Z',
    bytes: 120253,
    type: 'upload',
    url: 'http://res.cloudinary.com/demo/image/upload/v1372275963/cr4mxeqx5zb8rlakpfkg.jpg',
    secure_url: 'https://res.cloudinary.com/demo/image/upload/v1372275963/cr4mxeqx5zb8rlakpfkg.jpg' } ]