Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Rotating the Image #82

Open
ekamnh opened this issue Sep 16, 2022 · 0 comments
Open

Auto Rotating the Image #82

ekamnh opened this issue Sep 16, 2022 · 0 comments

Comments

@ekamnh
Copy link

ekamnh commented Sep 16, 2022

Hello I am using multer-sharp-s3 for upload and resize images on s3

but some how it's auto rotating some images

Can anyone help on this

`const upload = multer({
fileFilter: (req, file, cb) => {
console.log(file);

if (file.mimetype == "application/octet-stream"){
    file.mimetype = 'image/jpeg';
}
if (file.mimetype == "image/png" || file.mimetype == "image/jpg" || file.mimetype == "image/jpeg") {
  cb(null, true);
} else {
  req.file_error = "INVALID";
  cb(null,false);
  //cb('Only .png, .jpg and .jpeg format allowed!', false);
  //return cb(new Error('Only .png, .jpg and .jpeg format allowed!'));

}

},
storage: s3Storage({
s3: s3,
Bucket: process.env.S3_BUCKET_NAME,
Key: (req, file, cb) => {
let originalname = file.originalname;
var extension = originalname.substr(originalname.lastIndexOf('.') + 1);
crypto.pseudoRandomBytes(8, (err, raw) => {
cb(err, err ? undefined : "v2/poster/" + raw.toString("hex"))+'.'+extension;
});
},
ACL: process.env.S3_ACL,
multiple: true,
resize: [{ suffix: "landingDeck", width: 800,height: 600, fit: "fill" }],
//resize: [{suffix: 'landingDeck' }],
//cacheControl: "max-age=31536000",

}),
});
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant