Skip to content

Instantly share code, notes, and snippets.

@marcusasplund
Created May 10, 2016 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcusasplund/b3cfd94c1ff218da20124ecc0105030c to your computer and use it in GitHub Desktop.
Save marcusasplund/b3cfd94c1ff218da20124ecc0105030c to your computer and use it in GitHub Desktop.
Resolve native imagepath in ionic2 with cordova-plugin-filepath
// with this plugin:
// https://github.com/hiddentao/cordova-plugin-filepath/
initializeApp() {
this
.platform
.ready()
.then(() => {
if (window.StatusBar) {
window
.StatusBar
.styleDefault();
}
if (window.plugins && window.plugins.webintent) {
window
.plugins
.webintent
.getExtra(window.plugins.webintent.EXTRA_STREAM, (data) => {
console.log(data);
this.getProperImageUrl(data);
}, (error) => {
console.log(error);
});
}
});
}
getProperImageUrl(data) {
window
.FilePath
.resolveNativePath(data, this.openCameraPageOnSuccess, this.errorCallback);
}
openCameraPageOnSuccess(realPath) {
console.log(realPath);
let image = [
{
src: realPath
}
];
let nav = this
.app
.getComponent('nav');
nav.push(CameraPage, {images: image});
}
errorCallback(data) {
console.log(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment