ikhsanalatsary/multer-sharp-s3

How to resize a image dynamically by passing a dynamic width

kashyap2468 opened this issue · 1 comments

I am trying to set the resizing width from the database values
I have successfully developed the function with the Static Width. but doing it dynamic from the database is not possible

Can please guide about making the width value dynamic from the database using Helper function.

let partsImageResolution = Helper.getResolution();
const uploadS4 = multer({
    storage: s4Storage({
         s3: s3,
        ACL: 'public-read',
        Bucket: 'mxcdn/parts',
        contentType: s4Storage.AUTO_CONTENT_TYPE,
        Key: (req, file, cb) => {
            cb(null, Date.now() + '-' + file.originalname);
        },
        resize: partsImageResolution
    })
}).any();

@kashyap2468 Since version 0.2.2 you can use _resize() but haven't documented it yet. For reference this. In the future I will change the property name to dynamicResize(). So for now, let it be working first.