当我通过相机拍摄照片时,它在ionic3中反转

时间:2019-01-18 06:47:06

标签: ionic-framework ionic3

这是我在旋转拍照后为拍照而编写的代码

const cameraOptions: CameraOptions = {
  quality: 50,
  saveToPhotoAlbum: true,
 //destinationType: this.camera.DestinationType.FILE_URI,
 destinationType: this.camera.DestinationType.DATA_URL,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE,
 // cameraDirection:this.camera.Direction.FRONT,
}
this.camera.getPicture(cameraOptions).then((imageData) => {

  let base64Image = imageData;
  this.image = base64Image;
  this.initia=false;
  this.ShowImg = 'data:image/jpeg;base64,' + base64Image;
  console.log("base64Image", base64Image);
  alert("Your photo is successfully uploaded.")

});
return this.image

1 个答案:

答案 0 :(得分:0)

请在cameraOptions上添加correctOrientation: true,它将为您提供帮助