|
|
|
@ -113,8 +113,7 @@ var user = require('./../user.js'),
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var filename = path.basename(oldpicture);
|
|
|
|
|
var absolutePath = global.configuration['ROOT_DIRECTORY'] + config.upload_path + filename;
|
|
|
|
|
var absolutePath = path.join(global.configuration['ROOT_DIRECTORY'], config.upload_path, path.basename(oldpicture));
|
|
|
|
|
|
|
|
|
|
fs.unlink(absolutePath, function(err) {
|
|
|
|
|
if(err) {
|
|
|
|
@ -124,9 +123,7 @@ var user = require('./../user.js'),
|
|
|
|
|
uploadUserPicture(req.user.uid, req.files.userPhoto.name, req.files.userPhoto.path, res);
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
function uploadUserPicture(uid, filename, tempPath, res) {
|
|
|
|
@ -165,8 +162,10 @@ var user = require('./../user.js'),
|
|
|
|
|
dstPath: global.configuration['ROOT_DIRECTORY'] + uploadPath,
|
|
|
|
|
width: 128
|
|
|
|
|
}, function(err, stdout, stderr){
|
|
|
|
|
if (err)
|
|
|
|
|
if (err) {
|
|
|
|
|
console.log(err);
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|