Cloudinary integration in meteor

I have tried every single crap on the web on cloudinary integration into meteor,and none worked (bugs,bad coding,curly b .missing,you name it!..
Any help on the matter will be highly appreciated.

i recently used the npm package https://github.com/cloudinary/cloudinary_npm. Have you tried that one already? What was the problem, maybe I can help…

hi tom tks for your reply,I m going to take a look at it abd I ll come back to you.

Did take a look .
My understanding is that a package must be install in the project directory.Do I need to install npm on linux? when I do how would the connection be made with my project?.Im completely confused.

I’m using https://github.com/Lepozepo/cloudinary, and here’s a simple client side version that’s working:

The html input:
<input type="file" name="featuredImage" ref="featuredImage" />

Inside the form handler:
(The upload method takes an array as the first param, an object of options as the second, then the callback)

let files = this.refs.featuredImage.files;
Cloudinary.upload(files, {}, (error, response) => {
  if (error) {
    Bert.alert( error.reason, 'danger' );
  } else {
    // response = object with details about the file(s)
  }
});

It took a little reading through the docs to get it to work properly because all his examples are in coffeescript. Hope this helps

The best and easiest of them all is, cosio55’s package. Use check package so it will work. Super simple

Please, take a look at this article to see how to use npm packages in your meteor project: https://themeteorchef.com/snippets/using-npm-packages/.

Please, also be more precise as to what you already tried and what did not work.

always assuming you use autoform in your project…

1 Like

well, I was in the same boat. I was trying to implement photo upload and all the options were failing. Using it inside autoform wasn’t my original intention. But when I tried packages that had autoform integration, it worked. So Just pointing that out to OP.

Uploading is ok for me,But I have to call the server with a different script to show the uploaded image,and I dont like it.Second I still cant show a progressbar,leaving user with no idea what s going on .

Would be highly appreciated,Dont forget the progresbar.

I was tempted to use the autoform but, it would be too hard for me to implement
multilanguage with Tapi18n.

1 Like

I wish you add binded the progress bar script ,I am struggling with it!

No I dont use autoform,simple reason is multilanguage.I have the upload part working but cannot make progressbar work.Any idea?

Template.contacto.events({
‘click .new-file’ : function(e, t){
e.preventDefault();

var files = []
var file = $(’#imgInp’)[0].files[0];
files.push(file)
console.log(files)
$(’.cloudinary-fileupload’).bind(‘fileuploadprogress’, function(e, data) {
$(’.progress_bar’).css(‘width’, Math.round((data.loaded * 100.0) / data.total) + ‘%’);
});

Cloudinary._upload_file(files[0], {}, function(err, res) {
if (err){
console.log(err);
return
}
The above is uploading without any problem ,but progressbar is not working