imagemagick resizing

v1.18.x
Baris Usakli 12 years ago
parent 40b8264d6e
commit d1041bedf4

@ -27,7 +27,8 @@
"marked": "0.2.8",
"bcrypt": "0.7.5",
"node-gyp": "0.9.5",
"async": "0.2.8"
"async": "0.2.8",
"node-imagemagick": "0.1.8"
},
"devDependencies": {},
"optionalDependencies": {},

@ -100,6 +100,8 @@ var user = require('./../user.js'),
var allowedTypes = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif'];
var type = req.files.userPhoto.type;
console.log(req.files.userPhoto);
if(allowedTypes.indexOf(type) === -1) {
res.send({
error: 'Allowed image types are png, jpg and gif!'
@ -161,6 +163,17 @@ var user = require('./../user.js'),
user.setUserField(uid, 'uploadedpicture', imageUrl);
user.setUserField(uid, 'picture', imageUrl);
var im = require('node-imagemagick');
im.resize({
srcPath: global.configuration['ROOT_DIRECTORY'] + uploadPath,
dstPath: global.configuration['ROOT_DIRECTORY'] + uploadPath,
width: 128
}, function(err, stdout, stderr){
if (err)
throw err;
});
});
os.on('error', function(err) {

Loading…
Cancel
Save