Zugriff auf die Kamera über Cordova (und genauer gesagt ionische, da Sie das ionische-Framework in Ihrer Frage getaggt) ist eine Frage der Installation des Plugins, ob Sie ionische verwenden oder nicht. Es gibt mehrere Kamera-Plugins aber das eine durch ionische empfohlen sind hier zu finden:
https://github.com/apache/cordova-plugin-camera
Zum Beispiel das Plugin zu Ihrem ionischen Projekt hinzuzufügen, einfach auszuführen:
ionic Cordova plugin add cordova-plugin-camera
Sie würden es verwenden wie dies in .ts Ihrer Komponente (zum Beispiel) file:
import { Camera, CameraOptions } from '@ionic-native/camera';
constructor(private camera: Camera) { }
...
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:
let base64Image = 'data:image/jpeg;base64,' + imageData;
}, (err) => {
// Handle error
});
wurde die obige Implementierung von hier genommen, wo weitere Details können als o finden:
https://ionicframework.com/docs/native/camera/
Hallo, ich bin lokking auch für diese Antwort. Hast du irgendwas gefunden? – GCoe