I managed to setup https://github.com/aguidrevitch/jquery-file-upload-middleware with express.js 4.0 but am having difficulties configuring it.
Here's my upload script:
var upload = require('jquery-file-upload-middleware');
upload.configure({
imageVersions: {
thumbs: {
width: 80,
height: 80
},
prev: {
width: 1280,
height: 1024
}
}
});
app.use('/admin/upload', function (req, res, next) {
// imageVersions are taken from upload.configure()
upload.fileHandler({
uploadDir: function () {
return __dirname + '/public/uploads/' + req.session.eventID;
}
})(req, res, next);
});
Uploading a Chicken.jpg file i get the following structure:
/public/uploads/ -> public uploads folder
534a8d502e889f8d6bf9cc07/ -> upload session folder
prev/ -> resized version folder
Chicken.jpg
thumbs/ -> another resized version folder
Chicken.jpg
Chicken.jpg -> original file
This is what i'm trying to achieve:
- Move the original file /public/uploads/534a8d502e889f8d6bf9cc07/Chicken.jpg out of the /public/uploads folder while keeping the resized versions in place.
- Add a watermark to the /public/uploads/534a8d502e889f8d6bf9cc07/prev/Chicken.jpg file.
Can anyone please advise?
Thank you!