I'm using Ionic native image picker: https://ionicframework.com/docs/native/image-picker/
I'm importing on my module
import { ImagePicker } from '@ionic-native/image-picker';
And adding on the module's providers
ImagePicker,
On my page I'm importing it
import { ImagePicker, ImagePickerOptions } from '@ionic-native/image-picker';
Adding to my constructor
private imagePicker: ImagePicker,
Then calling a method on a button
async pickImageFromGallery() {
try {
const [imageSource] = await this.imagePicker.getPictures(this.pickerOptions);
this.imgSrc = imageSource;
It does work and I can get the file URI, however when I try to display on an <img>
tag the image doesn't show up
<img src="{{ imgSrc }}" alt="" />
Do I need to configure some permission or something? Why doesn't the image show up?
Instead of
this.imgSrc = imageSource;
I didWorks on both iOS and Android.
If you run into problems like Android crashing try this:
First I cleaned my project
Then installed packages
Then deploy the app again
You have to add "" in your src