Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* POST an assassin (from the homepage) */
- router.post('/assassin', upload.array('file', 10), function(req, res, next) {
- var newAssassin = new Assassin(req.body);
- var newPicture = new Picture();
- newPicture.location = req.files[0].filename;
- newPicture.mimeType = req.files[0].mimetype;
- newPicture.save();
- easyimg.exec("convert ./public/images/uploads/" + newPicture.location + " -resize '275x275^' -gravity center -crop 275x275+0+0 -colorspace Gray -gamma 2.2 +repage ./public/images/uploads/" + newPicture.location).then(
- function(image) {
- console.log("Photo Saved...");
- newAssassin.images.push(newPicture);
- console.log(newAssassin);
- newAssassin.save(function(err, assassin){
- console.log("Before error");
- if(err){ return next(err); }
- console.log("Sending confirmation...");
- sendConfirmation(newAssassin._id);
- console.log("Confirmation sent.");
- res.json(assassin);
- });
- },
- function (err) {
- console.log(err);
- }
- );
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement