var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, '/tmp/my-uploads')
},
filename: function (req, file, cb) {
cb(null, file.fieldname + '-' + Date.now())
}
})
var upload = multer({ storage: storage })
I need to resize the image and compress the image size to lowest and upload into the directory.Any help?
This can be done using multer-imager npm module.
http://www.npmjs.com/package/multer-imager
make sure you install graphicsmagick before that(not npm module). Click on the link below to install graphicsmagick.
Then install multer-imager and gm npm module.