Code Monkey home page Code Monkey logo

cloudinary_npm's Introduction

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

// Require the Cloudinary library
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

Licence

Released under the MIT license.

cloudinary_npm's People

Contributors

asisayag2 avatar bompus avatar cloudinary-jenkins avatar cloudinary-pkoniu avatar codeinvain avatar dannyv-cloudinary avatar eitanp461 avatar gching avatar gingermusketeer avatar igy avatar itaibenari avatar karlhorky avatar konforti avatar laurynas-karvelis avatar nadavofi avatar nadavofir avatar nadavs avatar nmn avatar patrick-tolosa avatar patsanes avatar raae avatar rudolf avatar shedar avatar strausr avatar tallevami avatar tamaracloudinary avatar thaiat avatar tocker avatar victorli-cloudinary avatar yomesinc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudinary_npm's Issues

Uploading video

I am using cloudinary.uploader.upload() to upload a video file.

However, I get the response as
{error: { message: 'Invalid image file', http_code: 400}}

The documentation says that I should be able to upload any files including videos but this does not seem to work in this case.

cloudinary.url() produces 404

cloudStream = cloudinary.uploader.upload_stream (result) =>
     thumb = cloudinary.url(result.public_id, { secure: true, width: 60, height: 60, crop: 'fill', type:'png' } ) 
imageStream = fs.createReadStream( file, { encoding: 'binary' } )
    .on('data', cloudStream.write)
    .on('end', cloudStream.end);

logging thumb produces:

https://res.cloudinary.com/MY_REPO/image/png/c_fill,h_60,w_60/fuyrxkuonqy7dhzkklgc

... which does not exist. I've also tried passing in url, version, and file without success.

[Question] How to run test?

I could see that we have npm run test which runs compilation and then mocha. Besides, there is also Cakefile for cake test.

It'd be nice if the team decided on a consistent way to run test.

Modularize client-side utils

Maybe I'm missing something, but here is a suggestion I'm contributing based on my current understanding.

Use Case

I want to use utils.url to generate urls in the client side part of a web app. I want to be able to include that part of the code only in my client bundle.

Suggestion

From that use case comes my suggestion:
Make the util url standalone so it can be included by a bundler by itself without all the other stuff.
This would be super useful for all of the utils that are useful client side. Make them all modules that can be included by themselves as needed.

Deleting raw files

As per the documentation I should only supply the public ID and the image gets deleted.

This works fine for image files. However, for video files (or raw files), this does not work. I get the response { result: 'not found' }

I am using cloudinary.uploader.destroy(<public_id>, callback, {invalidate: true}); to delete the file but it fails only for raw files. Is there any special handling required when deleting raw files?

Upload stream does not support pipe

It would be great if upload_stream supported normal stream features such as pipe.

Also the callback for the stream does not follow the convention for callbacks in node

Cloudinary Upload Request getting Timed Out for images of size greater than 50 Kb

Hi,

While uploading files of greater than 50 kb, I'm getting timed out from cloudinary response.

message: 'Request Timeout', http_code: 499

Code:

cloudinary.config(config.cloudinaryConfig);  // config of cloudinary

function uploadFileInCloudinary(fileObj, callback) {
    console.log(fileObj);
    if(fileObj && (fileObj != undefined)) {
        console.log(fileObj['path']);
        cloudinary.uploader.upload(fileObj['path'], function(err, result) {
            if(err) {
                console.log(err);
                return callback(err);
            }
            console.log("cloudinary result");
            console.log(JSON.stringify(result));
            return callback(null, result);
        });
    } else {
        return callback("error");
    }
}

Can anyone give me some pointers if this expected behaviour or I'm missing anything ?

Thanks

Support node style callbacks

The cloudinary node client has a very uncommon callback style.
In node the callback should be called with the error object as its first argument.

This pattern allows you the use transformations like promisify.

Feature Request: Streaming upload (aka Transfer-Encoding: chunked)

Currently, uploading requires "multipart/form-data" which requires a "Content-length" header. Unfortunately, this requires that photos be either loaded (buffered) in memory or saved to disk first, creating significant performance bottlenecks.

This is infeasible for large projects that involve photos being uploaded from the client through the server to Cloudinary as is the case when migrating existing native app installs to Cloudinary without needing to update the app.

"Transfer-Encoding: chunked" support at least for file uploads in place of multipart/form-data would solve this.

Cloudinary service responded with HTTP Code: 500 and HTML instead of JSON

I've noticed that if your server returns HTTP 500 status code with HTML instead of JSON your npm module exits node.js app completely!

undefined:1
<!DOCTYPE html>
^
SyntaxError: Unexpected token <
    at Object.parse (native)
    at IncomingMessage.res.on.error (/Users/laurynas/www/reversio/node_modules/cloudinary/lib/uploader.coffee:304:25)
    at IncomingMessage.EventEmitter.emit (events.js:126:20)
    at IncomingMessage._emitEnd (http.js:366:10)
    at HTTPParser.parserOnMessageComplete [as onMessageComplete] (http.js:149:23)
    at CleartextStream.socketOnData [as ondata] (http.js:1367:20)
    at CleartextStream.CryptoStream._push (tls.js:526:27)
    at SecurePair.cycle (tls.js:880:20)
    at EncryptedStream.CryptoStream.write (tls.js:267:13)
    at Socket.ondata (stream.js:38:26)

uploader.coffee handle_response and api.coffee call_api tries to parse JSON assuming everything will be fine.

Please add a try catch sections for JSON.parse() there in case your servers are down and responding with non-JSON.

upload with err, callback

It would be nice if cloudinary.uploader.upload() returned an error in the callback, e.g.

var upload = require('cloudinary').uploader.upload
upload('http://bit.ly/15RFz9B', function (err, result) {
  console.log(err, result)
})

Uploader.destroy doesn't work

I need to destroy images from your cloud.
I know that function uploader.destroy doesn't described in read.me.

When I tried to call cloudinary.uploader.destroy I found error TypeError: Cannot set property 'signature' of undefined. This error appears in call_api function of uploader when you tried t get params, cause function get_params doesn't return array, it returns Object.

upload_large using chunk_size is corrupting data

I'm trying to upload an 8mb file ( type raw or image ) using a chunk_size of 6000000. What I am seeing is that on completion, the file size matches, but the file data is corrupted around the location of the second chunk.

I've tried several different files including dummy test files, jpegs, and pdfs of different sizes. If the file is transmitted using a single chunk ( chunk_size is larger than file size ) , the md5 matches. If multiple chunks are involved, the md5 is different, and the md5 changes as you experiment with different chunk sizes ( 5500000 vs 6000000 for example )

Can you update your tests for upload_large ( and all other upload tests? ) to check filesize AND compare etag/md5 to the original md5 to verify the uploaded data matches.

Photos cannot be downloaded with the function of private_download_url

I've been using cloudinary for a long time and everything is fine. And it's also ok to upload private photos and pdfs.

But today when I tried to download the private photos, something went wrong.

var url = cloudinary.utils.private_download_url(publicid);

The url I get was something like:

https://api.cloudinary.com/v1_1/myappname/image/download?timestamp=1417560245&public_id=mfzmfjhzmcnh2ksp2qs1&signature=4e857d76e3b773b6cbb3129fffed185d725854c8&api_key=616622821755xxx

But when I put it in the browser, I got:

{
  "error": {
    "message": "Resource not found - mfzmfjhzmcnh2ksp2qs1"
  }
}

What the problem could be?
But the mfzmfjhzmcnh2ksp2qs1 is there of course. I saw it in the backend of cloudinary console media_library.

How to subscribe to finish event in cloudinary.uploader.upload_stream ?

I need to use event subscription instead of callback when using cloudinary.uploader.upload_stream:

var stream = cloudinary.uploader.upload_stream(function(result) { 
    console.log(result);
});

Something like the following:

var stream = cloudinary.uploader.upload_stream();
stream.on('finish', function (result) {
   console.log(result)
});

But it seems finish event does not exists because console.log doesn't get executed.

"Uncaught ReferenceError: image is not defineds"

Uncaught ReferenceError: image is not defineds
@ all.js:105rt.event.dispatch
@ all.js:2m.handle
@ all.js:2

I'm using Cloudinary widget. But, after a url is set to 'Public URL of an image file:' in Cloudinary widget, the error message above occurs.

screen shot 2015-12-21 at 11 48 19 am

Failing tests, has API changed or is service down?

The following tests started failing. http://status.cloudinary.com shows all services are up.

api
✓ should allow listing resource_types (1400ms)
✓ should allow listing resources (1377ms)
✓ should allow listing resources with cursor (2746ms)
✓ should allow listing resources by type (1351ms)
✓ should allow listing resources by prefix (1325ms)
✓ should allow listing resources by tag (1584ms)
✓ should allow listing resources by public ids (1367ms)
✓ should allow get resource metadata (1519ms)
1) should allow deleting derived resource
2) should allow deleting resources
✓ should allow deleting resources by prefix (7053ms)
3) should allow deleting resources by tags
4) should allow listing tags
✓ should allow listing tag by prefix (1691ms)
✓ should allow listing tag by prefix if not found (1376ms)
✓ should allow listing transformations (1430ms)
✓ should allow getting transformation metadata (1549ms)
✓ should allow getting transformation metadata by info (1367ms)
✓ should allow updating transformation allowed_for_strict (6399ms)
✓ should allow creating named transformation (4760ms)
✓ should allow unsafe update of named transformation (5583ms)
✓ should allow deleting named transformation (2722ms)
5) should allow deleting implicit transformation
✓ should support the usage API call (1466ms)
✓ should allow deleting all resources (9582ms)

20 passing (1 minutes)
5 failing

  1. api should allow deleting derived resource:
    Error: General Error
    at /home/rudolf/Workspace/qurio/node_modules/cloudinary/test/api.coffee:225:27
    at IncomingMessage. (/home/rudolf/Workspace/qurio/node_modules/cloudinary/lib/api.coffee:273:18)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  2. api should allow deleting resources:
    Uncaught Error: expected undefined to not equal undefined
    at Assertion.assert (/home/rudolf/Workspace/qurio/node_modules/expect.js/expect.js:99:13)
    at Assertion.be.Assertion.equal (/home/rudolf/Workspace/qurio/node_modules/expect.js/expect.js:200:10)
    at Assertion.(anonymous function) as be
    at /home/rudolf/Workspace/qurio/node_modules/cloudinary/test/api.coffee:257:43
    at IncomingMessage. (/home/rudolf/Workspace/qurio/node_modules/cloudinary/lib/api.coffee:273:18)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  3. api should allow deleting resources by tags:
    Error: General Error
    at /home/rudolf/Workspace/qurio/node_modules/cloudinary/test/api.coffee:297:27
    at IncomingMessage. (/home/rudolf/Workspace/qurio/node_modules/cloudinary/lib/api.coffee:273:18)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  4. api should allow listing tags:
    Uncaught Error: expected [ '503dfc813b5918564b3ad817',
    '5045e62400f3628113456448',
    '5065ace923a5337d80524e4b',
    '506953adf554c0020000014c',
    '50695c5ce05b77020000009f',
    '50695df3e05b77020000010a',
    '5069764fe05b7702000002b8',
    '50697d20e05b77020000037b',
    '5078074a030535020000015e',
    '50853140bf81ee0200000224' ] to contain 'api_test_tag'
    at Assertion.assert (/home/rudolf/Workspace/qurio/node_modules/expect.js/expect.js:99:13)
    at Assertion.string.Assertion.contain (/home/rudolf/Workspace/qurio/node_modules/expect.js/expect.js:397:12)
    at /home/rudolf/Workspace/qurio/node_modules/cloudinary/test/api.coffee:317:32
    at IncomingMessage. (/home/rudolf/Workspace/qurio/node_modules/cloudinary/lib/api.coffee:273:18)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

  5. api should allow deleting implicit transformation:
    Uncaught TypeError: Cannot read property 'http_code' of undefined
    at /home/rudolf/Workspace/qurio/node_modules/cloudinary/test/api.coffee:468:40
    at IncomingMessage. (/home/rudolf/Workspace/qurio/node_modules/cloudinary/lib/api.coffee:273:18)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16
    at process._tickCallback (node.js:415:13)

without crop parameter, width is ignored

I tried the simplest transformation, which was simply setting the width option. But the resulting URL didn't include it. Turns out that when including width and/or height, you must also set crop. That ain't right.

Working with es6 modules?

Hey,

I am just trying to import the package in an es6 app,
But I've got an error from the sources of the chunking-stream dependency module.

Basically, just the call of :

import cloudinary from 'cloudinary';

throws an error : Uncaught Error: Cannot find module './lib/size-chunker'

My environment :

node: v0.12.4
cloudinary: v1.2.5

// For the story, I am building a mobile app in es6 using React.js
browserify: v11.1.0
babelify: v6.3.0
react: v0.14.0

Full example of entire process

Hello!

It would be really helpful, and most likely clear up your stack overflow issues, if you included an end to end example of node.js signature and image upload.

thanks!!

Invalid Signature error

i'm getting the following message back when i try to upload:

{ error: { message: 'Invalid Signature 53c516a1618fe4d88a81a0b6289e83a205608cbe. String to sign - \'timestamp=1439054775\'.', http_code: 401 } }

i followed the config example provided in the documentation. looks like:

cloudinary.config({ cloud_name: 'some-cloud', api_key: API_KEY, api_secret: CLOUD_API_SECRET });

can anyone tell me what i'm doing wrong?

Stream Errors

First, great job on the module!

I have been trying to kill a bug when upgrading from version 1.0.13 to 1.1.0 or anything higher. I am working up a test and reproduction instructions right now, will post details in a few.

Here is the initial error when trying to kill the stream:

_stream_writable.js:344
  if (!state.ending && !state.finished)
            ^
TypeError: Cannot read property 'ending' of undefined
    at Stream.Writable.end (_stream_writable.js:344:13)
    at Stream.emit (events.js:92:17)
    at ChildProcess.<anonymous>     (/home/mclenithan/www/soundselect/node_modules/webshot/lib/webshot.js:242:9)
    at ChildProcess.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:820:12)

If this sounds obvious, stop me there, otherwise I will have a write up to follow shortly.

cloudinary.url() promise

Wouldn't it be good with a promise on cloudinary.url()

I'm trying to get images by sending a request to an external node server but the image isn't loaded when the response is sent so to do

cloudinary.url().then(function(data){
res.json(data)
})

would be good..

Distribute as compiled JavaScript

Right now all files in lib are distributed as coffeescript and cloudinary.js uses require('coffee-script/register');. Not only does this pollute the global scope require.extensions with unneccesary junk but it adds overhead that shouldn't be necessary.

cloudinary.image mutates option arguement

The option argument being passed in to cloudinary.image is being used directly without being copied, resulting in a mutated option object as an end result.

Reproduction:

var cloudinary = require('cloudinary');
var options = {
  fetch_format: "auto",
  flags: "progressive"
};
cloudinary.image("random_id", options);
// options now is {} because cloudinary.image mutated it

Made a pull request to fix this (I basically just extend it using lodash like what cloudinary.url does): #54

Problem uploading base64 image string

My image data comes in string format, encoded in base64

"data:image/png;base64,iVBORw0KGgo .... "

But the current version of your module tries to treat my string as a file path which does not work :)

Is it possible to change line 73 of uploader.coffee

from

if file.match(/^https?:/)

to

if file.match(/^https?:/) || file.match(/^data:image/\w*;base64,([a-zA-Z0-9/+\n=]+)$/)

I took the regex from the equivalent ruby module

cheers!

Cloudinary Integration using Node.js

0
down vote
favorite

I'm trying to integrate Cloudinary in my project for uploading images. I have just started using following links:

http://cloudinary.com/documentation/node_image_upload https://github.com/cloudinary/cloudinary_npm/blob/master/samples/basic/basic.js

I stuck at a point where I can see image uploaded to Cloudinary in my dashboard but in my code the response is undefined.

cloudinary.config(config.cloudinaryConfig);
function uploadFileInCloudinary(fileObj, callback) {
    console.log(fileObj);
    if(fileObj && (fileObj != undefined)) {
        console.log(fileObj['path']);
        cloudinary.uploader.upload(fileObj['path'], function(err, result) {
            if(err) {
                callback(err);
            }
            console.log("cloudinary result");
            console.log(JSON.stringify(result));  // undefined
            callback(null, result);
        });
    } else {
        callback("error");
    }
}

why is it so ? Can anyone give me some pointers where am I doing wrong ?

Errors should always return `http_code`

In production, I've seen several errors returned from cloudinary where result.error.message is: Server returned unexpected status code - 502 or Server returned unexpected status code - 504. However, the result.error.http_code is undefined. Since we obviously know the status code, it would be great to have that filled out too – in the name of consistency :)

Bug in samples/basic

basic.js#L41 causes the above error.

When I comment the line, the sample code runs without problem.

_stream_writable.js:175
    encoding = state.defaultEncoding;
                    ^
TypeError: Cannot read property 'defaultEncoding' of undefined
    at ReadStream.Writable.write (_stream_writable.js:175:21)
    at ReadStream.emit (events.js:95:17)
    at ReadStream.<anonymous> (_stream_readable.js:748:14)
    at ReadStream.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:410:10)
    at emitReadable (_stream_readable.js:406:5)
    at readableAddChunk (_stream_readable.js:168:9)
    at ReadStream.Readable.push (_stream_readable.js:130:10)
    at onread (fs.js:1568:12)
    at Object.wrapper [as oncomplete] (fs.js:459:17)

Error: Invalid encoding in tags

When tagging products by words which have UTF-8 characters like: Århus, København, På landet, etc.

The NodeJS request fails with an error response like: {"error":{"message":"Invalid encoding in tags","http_code":400}}

What should be done to workaround this?

url() options are ordered

in the example you say

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

this generate the cloudinary url but it seem to append options in an alphabetical order

with one of my image calling
cloudinary.url("fakeid.png", {width: 100, height: 150, crop: "fill"})

gives me
http://res.cloudinary.com/dc1emihjc/image/upload/c_fill,h_150,w_100/fakeid.png

with c_fill before width and height, and this does not return any image
if i put the c_fill after w_100and h_150 directly in the url it works

so either your API have to support non ordered options, or the node lib should not order them.

thanks for your feedback

newest version seems to have a problem

I'm getting this error:

SyntaxError: /var/www/html/example.com/node_modules/cloudinary/node_modules/lodash/index.js:7591
    /**
    ^^^
Unexpected token ILLEGAL

Add method to generate a webhook signature

This method would be used to validate the webhook signature is valid.

Based on the documentation:

The signature is calculated as follows:
SHA1-Hex-Digest("{data}{timestamp}{api_secret}")

Usage:

    var data = response.body;
    var x_ts = response.header['X-Cld-Timestamp'];
    var x_sig = response.header['X-Cld-Signature'];

    var sig = cloudinary.utils.webhook_signature(data, x_ts)

    if (sig == x_sig) {
        console.log('valid');
    } else {
        console.log('invalid');
    }

Socket hang up

I tried to remove images from cloudinary service by cloudinary.api.delete_resources, but sometimes I got:

events.js:71
throw arguments[1]; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (http.js:1264:15)
at CleartextStream.socketCloseListener (http.js:1315:23)
at CleartextStream.EventEmitter.emit (events.js:126:20)
at SecurePair.destroy (tls.js:938:22)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)

After this, node js failed.

Some eager transformations does not return width/height of the new image

Example 1 - all is good:
cloudinary.uploader.explicit('id', function (result) {
  console.log(result);
  /*{
    // ...
    width: 3264,
    height: 2448,
    eager: [
      {
        width: 662,          <=== SIZE AVAILABLE
        height: 496,
        url: '...',
        secure_url: '...'
      }
    ]
  }*/
}, {
  type: 'upload',
  eager: {
    transformation: [
      {
        crop: 'crop',
        x: 0,
        y: 0,
        width: 3264,
        height: 2445
      },
      {
        crop: 'limit',
        width: 1140,
        height: 496,
        gravity: 'center',
        quality: 90,
        flags: 'progressive',
        format: 'jpg'
      }
    ]
  }
});
Example 2 - width and height are unavailable:
cloudinary.uploader.explicit('id', function (result) {
  console.log(result);
  /*{
    // ...
    width: 3264,
    height: 2448,
    eager: [
      {
                            <=== WHERE IMAGE SIZE?
        url: '...',
        secure_url: '...'
      }
    ]
  }*/
}, {
  type: 'upload',
  eager: {
    transformation: [
      {
        crop: 'crop',
        x: 0,
        y: 0,
        width: 3264,
        height: 2448 // <= difference
      },
      {
        crop: 'limit',
        width: 1140,
        height: 496,
        gravity: 'center',
        quality: 90,
        flags: 'progressive',
        format: 'jpg'
      }
    ]
  }
});

Reject promise for error codes 400, 401, 404, 420 and 500 during file upload

Inside handle_repsone method (file: lib/uploader.coffee), for HTTP error codes 400,401,404,420 and 500, promise is being resolved deferred.resolve(result) (line number: 178) with result object holding the error object. Instead, shouldn't the promise be rejected with preferably error object deferred.reject(result["error"]) or result object deferred.reject(result)?

Different colors for the same image

I'm trying to upload one image, and always get different results for colors:

> c.uploader.upload('http://res.cloudinary.com/dlvphoomb/image/upload/v1441577895/m8wm8q4fnqqtegdumsog.png', function(result){console.log(result.colors)}, {colors: true})
[object Object]
> [ [ '#FF0000', 60 ], [ '#00FF00CC', 40 ] ]
> c.uploader.upload('http://res.cloudinary.com/dlvphoomb/image/upload/v1441577895/m8wm8q4fnqqtegdumsog.png', function(result){console.log(result.colors)}, {colors: true})
[object Object]
> [ [ '#FF0000', 60 ], [ '#00FF005A', 40 ] ]
> c.uploader.upload('http://res.cloudinary.com/dlvphoomb/image/upload/v1441577895/m8wm8q4fnqqtegdumsog.png', function(result){console.log(result.colors)}, {colors: true})
[object Object]
> [ [ '#FF0000', 60 ], [ '#00FF002C', 40 ] ]
> c.uploader.upload('http://res.cloudinary.com/dlvphoomb/image/upload/v1441577895/m8wm8q4fnqqtegdumsog.png', function(result){console.log(result.colors)}, {colors: true})
[object Object]
> [ [ '#FF0000', 60 ], [ '#00FF0017', 40 ] ]
> c.uploader.upload('http://res.cloudinary.com/dlvphoomb/image/upload/v1441577895/m8wm8q4fnqqtegdumsog.png', function(result){console.log(result.colors)}, {colors: true})
[object Object]
> [ [ '#FF0000', 60 ], [ '#00FF00', 40 ] ]

Generate upload signatures

There is no documentation that I can find on generating secure upload signatures for upload clients. The iOS documentation says that the serverside SDKs should support this but I cannot find documentation. Please advise. Thanks!

Can we provide authN for the imageURL for cloudinary upload?

I'm tying two systems together which means I get an image URL from SystemA and upload it to cloudinary for SystemB ... but SystemA's URLs are protected, so I run into:

{
  "error" : {
      "message" : "Error in loading https://.../api/images/products/1/1 - 401 Unauthorized",
      "http_code":400
    }
}

Is there some way to pass credentials for the URL to cloudinary? Other than URL hacking it to read like so: https://username:password@.../api/images/products/1/1

Default image url for widget.

Hi team,

There is no option to set a remote image url when a cloudinary widget is opened. Could you add the option?

Thanks.

Params not getting passed in DELETE method

Not sure why there is this IF statement in the call_api function:

if (method === "get") {
  api_url += "?" + query_params;
}

So when I initiate any DELETE methods, none of the params get through, thus, causing an error.

When I took out the IF condition, my delete requests work because the params/query get passed with the request.

How to get etag?

Can you please provide an example of how we can use this library to perform a HEAD request to fetch the etag for a given public id of an image?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.