2017-02-10 148 views

回答

1
function readImage(url, callback) { 
    var request = new 
    XMLHttpRequest(); request.onload = function() { 
     var file = new FileReader(); 
     file.onloadend = function() { 
      callback(file.result); 
     } 
     file.readAsDataURL(request.response); }; 
     request.open('GET', url); 
     request.responseType = 'blob';    
     request.send(); 
} 

和通話功能

readImage('[path image] ', function(base64) { console.info(base64); 
});