当我拍照时,一切正常。图片已制作好,之后我会在页面上看到它。当我单击以重新拍摄照片时,我可以做到,但是现在出现了问题。旧照片放在Ive拍摄的第一张照片下面。我知道,在我的第一张照片下面可以看到我的2.张照片中的一点点。要查看我的第二张照片,我拍摄了3.张照片(第二次重拍照片)。现在删除了第一张照片,顶部是2. pic,下面是3. pic。重新拍摄照片后,如何才能将照片直接删除?
export class PostPage {
public photos: any;
public base64Image: string;
constructor(public navCtrl: NavController, private camera: Camera) {
}
ngOnInit(){
this.photos = [];
}
ionViewDidEnter(){ //Damit Kamera automatisch öffent
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) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64:
this.base64Image = 'data:image/jpeg;base64,' + imageData;
this.photos.push(this.base64Image);
this.photos.reverse();
}, (err) => {
// Handle error
});
}
cancel(){
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) => {
// imageData is either a base64 encoded string or a file URI
// If it's base64:
this.base64Image = 'data:image/jpeg;base64,' + imageData;
this.photos.push(this.base64Image);
this.photos.reverse();
}, (err) => {
// Handle error
});
}
}