Ich habe versucht, ein Bild aus der Bibliothek in Ionic Projekt anzuzeigen.So zeigen Sie ein Bild aus der Bibliothek in Ionic 3 an
I verwendet:
- Ionic 3
- Angular 4
- iOS-Emulator
In Comopent:
const options: CameraOptions = {
quality: 100,
sourceType: PictureSourceType.PHOTOLIBRARY,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
};
this.camera.getPicture(options)
.then(imageUri => {
console.log(imageUri);
this.selectedPictureUri = imageUri;
})
.catch(error => {
console.error(error);
});
In HTML:
<img *ngIf="selectedPictureUri" [src]="selectedPictureUri">
Die URL erhalten werden, sind die folgenden:
file:///Users/...692F7E7A4086/tmp/cdv_photo_015.jpg
In Konsole folgenden Fehler auf:
Not allowed to load local resource: file:///Users/...692F7E7A4086/tmp/cdv_photo_015.jpg