I would like to get the image file from cloudinary through a public_id (currentPostId)
var currentPostId = this._id;
var file = $('#userimage')[0].files[0];
if ("undefined" === typeof file) {
var photo = cloudinary.image(currentPostId+".jpg");
Cloudinary.upload(photo, {public_id: postProperties._id}, function(err, res) {
console.log("Upload Error: " + err);
console.log("Upload Result: " + res);
});
}
but I got the following error message:
app.js:372 Uncaught TypeError: cloudinary.image is not a function
at Object.submit form (app.js:372)
at blaze.js:3775
at Function.Template._withTemplateInstanceFunc (blaze.js:3744)
at Blaze.View.<anonymous> (blaze.js:3774)
at blaze.js:2617
at Object.Blaze._withCurrentView (blaze.js:2271)
at Blaze._DOMRange.<anonymous> (blaze.js:2616)
at HTMLFormElement.<anonymous> (blaze.js:863)
at HTMLDivElement.dispatch (jquery.js:4722)
at HTMLDivElement.elemData.handle (jquery.js:4390)
Is it possible for me to try like this but how could I get the url of my photo?:
var photo = New File('url');