Git Product home page Git Product logo

cloudinary's Introduction

Cloudinary Image/File Uploader

This is a blaze-only package! 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 (cloudinary_js feels unstable in certain situations).

Outlook

This is a quick implementation of the uploader, feel free to fork it and improve on it like so many people did for S3 ^_^. I'm always open for pull requests too.

Installation

$ mrt add cloudinary

How to upload

Step 1

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"
});

Step 2

Create a Cloudinary input with a callback function. CLIENT SIDE.

{{#cloudinary_upload callback="save_url"}}
	<input type="file">
{{/cloudinary_upload}}

Step 3

Define a callback function that will handle what to do with Cloudinary's response. SERVER SIDE.

Meteor.methods({
	save_url:function(response){
		console.log('Add '+response.upload_data+' to the id of '+response.context);
	}
});

How to read and manipulate

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:

<img src="{{c_url public_id format=format}}">

You can manipulate an image by adding parameters to the helper

<img width="250" src="{{c_url public_id format=format effect='blur:300' angle=10}}">

Here are all the transformations you can apply: http://cloudinary.com/documentation/image_transformations#reference

How to delete from Cloudinary

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.

Meteor.call("cloudinary_delete","public_id",function(e,r){
	if(!e){
	  	console.log(r);
	}
});

Notes

I'll try to use a stream instead so we can get a progress bar on this.

cloudinary's People

Contributors

lepozepo avatar

Watchers

James Cloos avatar  avatar

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.