在我的快遞應(yīng)用程序中,我將我的圖像保存到我的倉庫中的文件夾中。但是,我不認(rèn)為這是正確的,我應(yīng)該將它們存儲在其他地方,我認(rèn)為s3將是一個(gè)不錯的選擇。我以前從未這樣做過,所以我不知道它是如何工作的。我的currrent代碼在縮放后保存圖像:exports.resize = async (req, res, next) => {
// check if there is no new file to resize
if (!req.file) {
next(); // skip to the next middleware
return;
}
const extension = req.file.mimetype.split('/')[1]
req.body.photo = `${uuid.v4()}.${extension}`
// now we resize
const photo = await jimp.read(req.file.buffer)
await photo.cover(300, 300);
// await photo.resize(800, jimp.AUTO);
await photo.write(`./public/uploads/${req.body.photo}`);
// once we have written the photo to our filesystem, keep going!
next()};什么過程是為了將圖像保存到aws s3?謝謝
如何在S3存儲桶中存儲圖像?
暮色呼如
2019-04-24 18:14:35