Lepozepo / cloudinary

MIT License
94 stars 42 forks source link

Add a control of upload size #14

Open romainkoenig opened 9 years ago

romainkoenig commented 9 years ago

I think it would be nice to add a property for example in the spacebars to control the maximum size of the upload. And to throw an error if needed. For now I intend to use this : Meteor.methods({ save_url:function(response){ if(response.upload_data > MAXIMUM_SIZE ){ //delete the file with the meteor call throw new Meteor.Error('max-size', 'the size of the image is too big MAXIMUM_SIZE allowed'); }else{ Image.update( {... } } } ); } });

But the problem is that it comes after the upload and not before, so there is unneeded use of cloudinary.

I find nothing on the cloudinary jQuery docs to handle that :/ They say there is one but I see nothing in the option they provide and where It think they must have made something : http://cloudinary.com/documentation/upload_images

Something like {{#c_upload callback="save_url" size_limit="MAXIMUM_SIZE"}}

{{/c_upload}}

Lepozepo commented 9 years ago

That would be pretty cool. I need to revamp the whole package though, I have learned a lot of new issues from my S3 package that impact this one as well. On the next round I give this package I will keep that in mind :D