我正在尝试获取图像的base64以便能够将其发送到API,但是我有一个corrumpu图像或类似的图像,因为当我在chrome中显示它时,它具有黑色图像。但是,我可以在我的应用程序中显示它。我不明白为什么我也有2条日志行和2个不同的base64
public takePicture() {
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
};
this.camera.getPicture(options).then(
imageData => {
this.base64Image = 'data:image/jpeg;base64,' + imageData;
this.form.base64_image = this.base64Image;
console.log('BAse64 :');
console.log(this.form.base64_image);
this.photos.push(this.base64Image);
this.photos.reverse();
},
err => {
console.log('Error : ' + err);
}
);
}
我在日志中得到了它:
2019-04-06 20:05:40.939 19714-19714/com.test.app D/SystemWebChromeClient: file:///android_asset/www/build/8.js: Line 290 : data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARCAvQD8ADASIAAhEBAxEB/8QAHQAAAwEBAQEBAQEAAAAAAAAAAwQFAgEGAAoHCf/EAF8QAAEDAQUEBgYGBgcHAwACEwMBAgQTABESISMUMTNDBSJBUVNjJDRhcXOBMkRUg5GhZJOjscHwQnSzw9HT4RVShJSk4/EGtMTz1ORi9CVyNYJFFlWSonWyB2XCheL/xAAbAQEBAQEBAQEBAAAAAAAAAAAAAgMBBAUGB//EAD8RAAIBAQQJBAICAwACAgEACwABAhExUYHBEiFBYXGhsdHwAyIykeHxE0JDUoIEI2JyM5IFosIUJAbSNFOy/9oADAMBAAIRAxEAPwD/ACCJgO2m97Vbs75GELU1GaWn8+/LkpdaLGiq0byEC5tMimoupsp1eF3Vvb/glm5YNm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HcLhCy4/dnZ1hmoMIqj6TaytaFw3Bx9pCeL+lffbuxjo+JBJHeK4cstRlZ3BZswuKNn48Zd2jndZQo3CrIwyjwtY0A3Rrw0SkzGPW/D77OPfllD/API+P/7yOenHY+L7dK46xpFeFqFR7mllhxFcnUZqqLTpr49LvX/ALVDBgwY5zhZHqPBR9Ze1lQRVJI53s/fb6U2RJDgZNRWDawbiPDo58vyhZejG+e9brYWEcktmA7TKMbAtaoRsfWzqx+6klT+ezsv/AMv3/wDvGk1Y8O2YsrmJERVkLKVDGdHnR+ptDCk+ujyN5PcmXzsyEjlSK+ReOpIe0ZgE66Pp1dPt3fzfkijYspAEMgmqoiBaTrDeNzL+H37LvDf2WeIiFC1BuG8oyVCudwW80Qx6P77a+pSUNW2zziux45+nZr4OnXLXeS2gqva4ZHDE1VWiF2N5vF1E4WtU7uddauKG163nIQrHekNcPqd9IZMsu3+G6yMfaXKwBljxwOI9xHBX0kq3er1PzreV562KRo2hRI6NUnUc0ZHYKO/TIT99/wDhbGC1N35fs88Y26K4+MWfHkSleMTilRxmVCYkx4NXTH5V6Ll22HsjySHwzseZjdUjX+D3j3JeD35brU4iHlzhua2gj+tIaNqvC19PS94kTk+zs32UljInTDCuloi4UxOw9RzN1Rf8n32ylH/29MX2Z5v/AD1/+P75p86DclDR+ijsMdpvSvQmhBklX7RS8n++9qL5QwmxJSucx40lD6ytXqY1QqfquTu8Hdfb0EkBwI5CyWq2QR5G0XYGN4Wo8SeP/hfaMxQEYQU0JSSL6Y25vCNnLX2fndvS2/o2ri+h8j/9YQ0vTs3J20dbjnR8c8dT9Iq8Tj3PQI2uXANlTmdlVN9/usn/ALMM0
答案 0 :(得分:0)
您可以使用文件传输。我也遇到了同样的问题,所以我使用了通过API进行文件传输。