//上传本地图片
function uploadLocalImg(src){
var formData = new FormData($("#upload_img")[0]);
var data = src;
data = data.split(',')[1];
data = window.atob(data);
var ia = new Uint8Array(data.length);
for (var i = 0; i < data.length; i++) {
ia[i] = data.charCodeAt(i);
}
var blob = new Blob([ia],{type:imgType,endings:'transparent'});
formData.append("image", blob, imgName);
$.ajax({
url: 'api/image/upload',
dataType: "json",
type: 'POST',
cache: false,
beforeSend: function(xhr){
if(token && token != ''){
xhr.setRequestHeader('token', token);
}
},
data: formData,
processData: false,
contentType: false,
success: function (data) {
if(data.isSuccessful){
var src = data.data.url;
var insertImg = '<img src="'+ src +'"style="max-width:100%;display:inline;">';
UE.getEditor('editor').execCommand('insertHtml', insertImg);
Common.floatingMessage("添加图片成功~");
$(".imgs").hide();
$(".dialog_mask").hide();

}else{
alert(data.message);
}
},
error: function (data) {
console.log(data);
}
});
}