我想通过public_id(currentPostId)从cloudinary获取图像文件
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);
});
}
但是我收到以下错误消息:
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)
我可以尝试这样做,但我怎么能得到照片的网址?:
var photo = New File('url');