node.js - 在 multer s3 模块中调整图像大小
问题描述
我想调整图像大小并将其上传到 s3 存储桶。
我尝试multer-s3-transform
了模块,但它没有用。
我尝试过使用它,但它也没有奏效。
const upload = multer({
fileFilter: fileFilter,
storage: multerS3({
s3: s3,
bucket: 'bucket',
acl: 'public-read',
shouldTransform: function(req, file, cb) {
cb(null, /^image/i.test(file.mimetype));
},
transforms: [
{
id: 'original',
transform: function(req, file, cb) {
//Perform desired transformations
cb(
null,
sharp()
.resize(600, 600)
.max()
);
}
}
]
})
});
解决方案
推荐阅读
- java - 如何将我的 SpringBoot 应用程序与 MySQL 数据库连接?
- python - Python Permission Problems Ubuntu
- image - 如何解决“找不到默认凭据”错误
- r - 如果行和列是R中的某个数字,如何填充矩阵?
- c++ - Why am I getting a Shader Compiler Error #143, #160 and #216 when comiling a vertex Shader using OpenGL?
- asp.net - 我如何在 Asp.net Core 2.0 中更新或更改密码
- imagemagick - 无法在 ImageMagick 中加载 base64 编码的 JPEG2000 字符串
- node.js - Webpack Build Fails with EPIPE error (Linux Subsystem only)
- javascript - How do I increment an array value up to another array value in Javascript?
- android - Does upgrading one Firebase project to a paid plan also benefit other projects?