dimanche 6 septembre 2015

Resizing the Given image into 3 different sizes before uploading into S3 Bucket

I am Currently saving the image into S3 Bucket using Skipper S3 npm module through Sails JS.

My Code for saving into s3 bucket using skipper is as follows:

req.file('imageName').upload({
        saveAs: 'FileName.png',
        adapter: require('skipper-s3'),
        key: 'key',
        secret: 'secret',
        bucket: 'bucketName'
    }, function whenDone(err, uploadedFiles) {
        if (err)
            //error handling
        else
            // return back the Image URl into S3.
    });

Currently I am following the methodology given in this link.This Methodology is not efficient and varies with the image size.

My Requirement is to resize the image(.png.jpg,.tif,.gif) into 3 different sizes (80*80,100*120 and 130*270). I want to save my initial image and 3 resized image into S3 Bucket simultaneously. But I am unable to extract the buffer for the given image through req.file.

I have referred the following questions on Stack overflow but I was unable to get my answer from them.

  1. Skipper in SailsJS (beta) image resize before upload
  2. Uploading multiple files with Sails.js 0.10 and Skipper using Dropzone.js
  3. Sails.js File upload with Skipper to AWS S3

Can somebody help with this?




Aucun commentaire:

Enregistrer un commentaire