var imgurl = data;
if (imgurl.indexOf("base64") != -1) {
    imgurl = data; 
} else if (imgurl.indexOf("data:image/jpeg;base64") == -1) {
   imgurl = "data:image/jpeg;base64,"+data;
} else if (imgurl.indexOf("data:image/png;base64") == -1) {
   imgurl = "data:image/png;base64," + data;
} else if (imgurl.indexOf("data:image/gif;base64") == -1) {
   imgurl = "data:image/gif;base64," + data;
}

 

posted on 2020-03-27 11:32  chenlw101  阅读(785)  评论(0编辑  收藏  举报