2017-05-03 19 views

回答

1

Use the Ionic Native Camera function

有一個質量選項範圍從0-100。它會返回一個壓縮的圖像

const options: CameraOptions = { 
 
    quality: 50, // Try changing this 
 
    destinationType: this.camera.DestinationType.DATA_URL, 
 
    encodingType: this.camera.EncodingType.JPEG, 
 
    mediaType: this.camera.MediaType.PICTURE 
 
} 
 

 
this.camera.getPicture(options).then((imageData) => { 
 
let base64Image = 'data:image/jpeg;base64,' + imageData; 
 
}, (err) => { 
 
// Handle error 
 
});

+0

對我來說好像離子無視任何質量我將它傳遞......這樣做對你的工作? – ewizard