@Ferozabdul wrote:
I want to set maximum upload image count of 3 in Camera plugin
How to do
Here is my code
import { Camera, CameraOptions } from '@ionic-native/camera'; constructor( private camera: Camera`) takePhoto() { let confirm = this.alertCtrl.create({ title: 'CHOOSE_PHOTO_FROM', //message: 'Are You Sure You Want To Permanently Delete These Picture', buttons: [ { text: 'CAMERA', handler: () => { this.TakeCamera(); } }, { text: 'GALLERY', handler: () => { this.TakeGallery(); } } ] }); confirm.present(); } TakeCamera() { 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.photos.push(this.base64Image); this.photos.reverse(); }, (err) => { console.log(err); }); } TakeGallery() { this.camera.getPicture({ sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM, destinationType: this.camera.DestinationType.DATA_URL }).then((imageData) => { this.base64Image = 'data:image/jpeg;base64,' + imageData; this.photos.push(this.base64Image); this.photos.reverse(); }, (err) => { console.log(err); }); } deletePhoto(index) { let confirm = this.alertCtrl.create({ title: 'Delete This Picture?', message: 'Are You Sure You Want To Permanently Delete These Picture', buttons: [ { text: 'No', handler: () => { } }, { text: 'Yes', handler: () => { this.photos.splice(index, 1); } } ] }); confirm.present(); }Thanks in Advance
Posts: 1
Participants: 1
