Hi All,
I am using Ionic 2, and am trying to capture and then save the image via JSON (saves to a database via a RESTful service), and then retrieve the image via JSON and display it.
My problem is I am also trying to implement an ImagePicker:
import { ImagePicker } from 'ionic-native';
imagePicker() {
let options = {
maximumImagesCount: 1,
width: 300,
height: 300,
quality : 75
};
ImagePicker.getPictures(options)
.then((results) => {
this.base64Image = "data:image/jpeg;base64," + results[0];
}, (error) => {
console.log("ERROR -> " + JSON.stringify(error));
});
}
I have a button to pick images from the gallery:
<button (click)="imagePicker()">
Pick from Gallery
</button>
However, when I deploy this app to my Android phone, the whole app works fine, except clicking the Pick from Gallery button does nothing.
I get the following error:
ERROR: "cordova_not_available"
Does this mean that the ImagePicker
plugin is not working or I have not set it up correctly?
import { ImagePicker } from 'ionic-native';
I did call the following to set it up, is there anywhere else I need to configure it?
cordova plugin add cordova-plugin-image-picker
Any advise will be appreciated, if anyone can point out what I am doing wrong with the ImagePicker, please let me know…