Ich verwende das native Plugin http://ionicframework.com/docs/native/camera/, um auf die Kamera oder Fotogalerie zuzugreifen. Ich brauche eine Lösung für den Zugriff auf die Kamera und Schalter auf die Fotogalerie, wenn nötig. Gibt es ein solches Plug-in oder nicht?Kamera und Foto-Bibliothek zusammen Ionic 2
0
A
Antwort
1
Wie Swapnil Patwa sagt im Kommentar, können Sie den Benutzer mit einem ActionSheet fragen:
public showActionSheet() {
let actionSheet = this.actionSheetCtrl.create({
buttons: [{
text: 'Load from gallery',
handler:() => {this.loadImage(this.camera.PictureSourceType.PHOTOLIBRARY);}
},{
text: 'Take a photo',
handler:() => {this.loadImage(this.camera.PictureSourceType.CAMERA);}
},{
text: 'Cancel',
role: 'cancel'
}]
});
actionSheet.present();
}
private loadImage(selectedSourceType:number){
let cameraOptions: CameraOptions = {
sourceType: selectedSourceType,
destinationType: this.camera.DestinationType.DATA_URL,
quality: 100,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true,
}
this.camera.getPicture(cameraOptions).then((imageData) => {
if(imageData!=null){
// Do with the image data what you want.
}
});
}
+0
Jetzt benutze ich actionSheet, aber zB in der 'Viber' App kannst du eine Kamera auswählen und zur Fotogalerie wechseln. Ich würde das gerne so organisieren. – wstudiokiwi
+0
Kamera ist ein natives Plugin, ich glaube nicht, dass es Ihnen erlaubt, das zu tun, im Doc von Ionic 2 finde ich diese Option nicht. –
Verwandte Themen
- 1. Ionic 2 Kamera Foto nicht angezeigt
- 2. Ionic 2 Kamera macht app Absturz
- 3. Ionic 2 Kamera funktioniert nicht am Telefon
- 4. Ionic 2 und github
- 5. Ionic 2 und GeoFire
- 6. Ionic 2 und ApiRTC
- 7. Ionic 2 Native Kamera - Dauer der Videoaufnahme begrenzen
- 8. Ionic 1 und Ionic 2 nebeneinander?
- 9. Firebase 3 + Ionic 2 + cordova-plugin-Kamera - Datei hochladen
- 10. Ionic Kamera GetPicture Plugin ignoriert
- 11. Ionic 2 und ng-Modell
- 12. Ionic 2 - Service und modalCtrl
- 13. Webpack und Web Worker in ionic 2
- 14. Angular 2, Ionic 2
- 15. Bildauswahl funktioniert nicht in ionic 2 App
- 16. Wie funktioniert Ionic 2 mit Angular 2?
- 17. iOS 10 - Änderungen der Abfrageberechtigungen von Kamera, Mikrofon und Fotobibliothek, die zum Absturz der Anwendung führen
- 18. Mit CORS und CSRF zusammen in Ionic App
- 19. Ionic Cordova Kamera Plugin Fehler auf Android
- 20. Wie Winkel 1.3.4 und Winkel 2 zusammen
- 21. Ionic 2 Android Build ist kaputt, obwohl in Ionic View und auf Ionic Serve funktioniert es gut
- 22. Ionic Nav-Back-Taste und Menü-Taste zeigen zusammen
- 23. Wie Fotobibliothek Pfad abrufen?
- 24. Filter Fotos von Fotobibliothek
- 25. herunterladen gesamte fotobibliothek phonegap
- 26. Ionic 2 Android Display-Layout und Funktionen
- 27. nativeStorage in ionic 2 und providers
- 28. Parse JSON mit Ionic 2 und Typoskript
- 29. Fotobibliothek ohne Verwendung von uiimagepicker starten
- 30. ionic 2 DatePicker
Sie Benutzer Galerie oder Kamera wählen auffordern können. Aber du kannst nicht wechseln. –