file main get image

This commit is contained in:
life
2015-12-18 16:50:34 +08:00
parent d18f1d1310
commit a2980904cf
9 changed files with 70 additions and 30 deletions

8
node_modules/api_main.js generated vendored
View File

@@ -55,9 +55,7 @@ var Api = {
date: 'Mon, 19 Jan 2015 15:01:47 GMT',
*/
// log(resp.headers);
if(err) {
callback(false);
} else {
else {
var typeStr = resp.headers['content-type'];
var type = 'png';
if(typeStr) {
@@ -68,15 +66,15 @@ var Api = {
}
var filename = Common.uuid() + '.' + type;
var imagePath = User.getCurUserImagesPath();
var imagePath = Evt.getCurUserImagesPath();
var imagePathAll = imagePath + '/' + filename;
log(imagePathAll);
fs.writeFile(imagePathAll, resp.body, function(err) {
if(err) {
log(err);
log('local save image failed 本地保存失败');
callback(false);
} else {
console.log('main save image success');
callback(imagePathAll, filename);
}
});