README
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
- 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
- Refer skipper documentations.