如何使用mutiparty直接调整多个图像的大小并将流发送到Cloudinary:
router.post('/', function(req, res){
var form = new multiparty.Form();
form.on('part', function(part) {
// Stream it to Cloudinary without saving it to disk
}
}
我这样做是因为我在Azure网站上托管,无法将图像保存在临时文件夹中。
答案 0 :(得分:0)
我不确定你可以尝试:
var cloudinary = require('cloudinary'); //npm install cloudinary
cloudinary.config({/*your config object*/});
var request = require('request'); //npm install request
router.post('/', function(req, res){
var form = new multiparty.Form();
form.on('part', function(part) {
if (part.filename) {
var url = cloudinary.url(part.filename, {type: 'fetch'/*, width: 256*/});
request.head(url, function (err, res, body) {
//...
});
}
}
}