1.0.1 • Published 8 years ago

skipper-s3-resize v1.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

skipper-s3-resize

Based on SailsJS Skipper S3 adapter for receiving upstreams with a twist: Images will be resized before uploading using GraphicMagick.

Installation

First of all, make sure you have graphicmagick installed.

To install it using npm:

$ npm install skipper-s3-resize --save

Also make sure you have skipper itself installed as your body parser. This is the default configuration in Sails as of v0.10.

Usage

  1. In Controller:
  upload: function(req, res) {
    req.file('image').upload({
      adapter: require('skipper-s3-resize'),
      key: <YOUR_S3_KEY>,
      secret: <YOUR_S3_SECRET>,
      bucket: <YOUR_S3_BUCKET>,
      resize: {
        width: <WIDTH>,
        height: <HEIGHT>,
        options: <GRAPHICMAGICK_OPTIONS>
      }
    }, function(err, uploadedFiles) {
      if(err) return res.serverError(err);
        res.ok();
      });
    }

Options

  1. Refer skipper documentations.