Hi guys,
my issue is about showing a picture after taken from camera.
my code to take a picture is the follow:
takePicture() {
this.camera.getPicture({
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE,
correctOrientation: true,
allowEdit: true,
targetHeight: 300,
targetWidth: 300
}).then(
(imagePath) => {
if (!_.isEmpty(imagePath)) {
this.navCtrl.push(PhotoPage, { "imagePath" : imagePath});
}
}, (err) => {
console.log("Error: " , err);
},
);
}
my PhotoPage code is in photo.ts:
import { Component } from '@angular/core';
import { IonicPage, NavParams } from 'ionic-angular';
@IonicPage()
@Component({
selector: 'page-photo',
templateUrl: 'photo.html',
})
export class PhotoPage {
private path: string;
private comment: string;
constructor(
private navParams: NavParams
) {
this.path = this.navParams.get("imagePath");
}
}
and the template photo.html is:
...
<ion-content padding>
<ion-card>
<img src="{{ path }}" />
</ion-card>
<ion-textarea placeholder="Comment" floating [(ngModel)]="comment"></ion-textarea>
</ion-content>
...
Doing this, the image is not showed
If I log the path I have for example the following:
file:///storage/emulated/0/Android/data/it.oandsi.photoshoot.com/cache/1522831151484.jpg
If I use DestinationType.DATA_URL, I got a base64 image and works fine, but I am interested to the path, because I have to use the crop function once get a picture from camera.
Please help me, maybe I do a mistake but I donât know.
Thanks