
$rootScope.FileDialog({
callback: function (fileList) {
$rootScope.showLoading();
$rootScope.$apply();
setTimeout(function () {
if (fileList) {
if (fileList.length == 0) {
//
} else if ((item.picSrcArray.length + fileList.length) > 10) {
$rootScope.showAlert($filter('translate')('B0501.msg.pic_limit', { num: 10 }));
} else {
var fs = window.nodeRequire('fs');
fileList.forEach(function (fileName) {
var image = fs.readFileSync(fileName);
if (image) {
if ($rootScope.compressImage) {
$rootScope.compressImage(new Buffer(image).toString('base64'),
function (data) {
item.picSrcArray.push({ filePath: data, fileName: fileName });
});
}
else {
item.picSrcArray.push({ filePath: new Buffer(image).toString('base64'), fileName: fileName });
}
}
});
}
}
$rootScope.hideLoading();
$rootScope.$apply();
});
}
});
这一段怎么修改使上传的图片转化为byte字节数组?