Cloudinary provides a simple way for uploading files to Cloudinary, which in turn can be set up to sync with your Amazon S3 service. This is useful for uploading and actively manipulating images and files that you want accesible to the public. Cloudinary is built on Cloudinary (NPM) and Cloudinary (JS). Installing this package will make Cloudinary
available server-side and $.cloudinary
available client-side.
Star my code in github or atmosphere if you like my code or shoot me a dollar or two!
{{#c_upload}}
does not exist anymore
All core methods and functions have been renamed and rewritten
This package does not use Streams anymore and uploads directly from the client to cloudinary!
CLIENT TO CLOUDINARY UPLOADS! Images will not stream to your server anymore, they will stream directly to cloudinary.
$ meteor add lepozepo:cloudinary
Configure your Cloudinary Credentials. SERVER SIDE AND CLIENT SIDE.
#SERVER
Cloudinary.config
cloud_name: 'cloud_name'
api_key: '1237419'
api_secret: 'asdf24adsfjk'
#CLIENT
$.cloudinary.config
cloud_name:"cloud_name"
Wire up your input[type="file"]
. CLIENT SIDE.
Template.yourtemplate.events
"change input[type='file']": (e) ->
files = e.currentTarget.files
Cloudinary.upload files,
folder:"secret" # optional parameters described in http://cloudinary.com/documentation/upload_images#remote_upload
(err,res) -> #optional callback, you can catch with the Cloudinary collection as well
console.log "Upload Error: #{err}"
console.log "Upload Result: #{res}"
All of Cloudinary's manipulation options are available in the c.url helper. You can access an image by passing a cloudinary public_id and format:
You can manipulate an image by adding parameters to the helper
You can use the collection-hooks package to hook up to the offline collection Cloudinary.collection
.
Here are all the transformations you can apply: http://cloudinary.com/documentation/image_transformations#reference
Just pass the public_id of the image or file through this function (security features pending). It will return an object with a list of the images deleted as a result.
Template.yourtemplate.events
"click button.delete": ->
Cloudinary.delete @response.public_id, (err,res) ->
console.log "Upload Error: #{err}"
console.log "Upload Result: #{res}"
A security filter is missing, I know how I want it to work I just haven't had the time to build it. Enjoy the new version!