Skip to content

Commit

Permalink
Updating readme with upload examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nadavs committed Jun 25, 2012
1 parent 2e9c84f commit 37fa747
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.project
11 changes: 11 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>cloudinary_npm</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,22 @@ Same goes for Twitter:
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')

cloudinary.uploader.upload("my_picture.jpg", function(result) { console.log(result) })

cloudinary.uploader.upload("my_picture.jpg")
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://d3jpl91pxevbkh.cloudfront.net/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:

Expand All @@ -97,7 +111,7 @@ The uploaded image is assigned a randomly generated public ID. The image is imme

You can also specify your own public ID:

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

cloudinary.url("sample_remote.jpg")

Expand Down

0 comments on commit 37fa747

Please sign in to comment.