async selectImage() {
const actionSheet = await this.actionSheetController.create({
header: "Выберите источник",
buttons: [
{
text: "Из галереи",
handler: () => {
this.takePicture(
this.camera.PictureSourceType.PHOTOLIBRARY
);
}
},
{
text: "Из камеры",
handler: () => {
this.takePicture(
this.camera.PictureSourceType.CAMERA);
}
},
{
text: "Отмена",
role: "cancel"
}
]
});
await actionSheet.present();
}
takePicture(sourceType: PictureSourceType) {
var options: CameraOptions = {
quality: 70,
targetWidth: 1560,
targetHeight: 2080,
destinationType: this.camera.DestinationType.DATA_URL,
sourceType: sourceType,
saveToPhotoAlbum: false,
correctOrientation: true
};
this.camera.getPicture(options).then(imagePath => {
this.images.push("data:image/jpeg;base64," + imagePath);
});
}
removeImage(index) {
this.images.splice(index, 1);
}