sails.js - Skipper resize image before uploading using adapter -
i have similar question this one. how can have upload rackspace adapter well?
here's code:
upload: function(req, res){ var rackspaceadapter = require('../adapters/rackspace/index'), receiver = rackspaceadapter.receive({ username: sails.config.rackspace.username, apikey: sails.config.rackspace.apikey, region: sails.config.rackspace.region, container: sails.config.rackspace.container }); req.file('file').upload(function (err, uploadedfiles) { if (err) return res.send(500, err); for(u in uploadedfiles){ gm(uploadedfiles[u]).resize('500','','^').gravity('center').crop('500','500').stream().pipe(receiver); } return res.json({ message: uploadedfiles.length + ' file(s) uploaded successfully!', files: uploadedfiles }); }); },
Comments
Post a Comment