Closed v-ken closed 6 years ago
Unknown, I don't use Ionic. Anyone ?
I found out how to do it:
$ npm uninstall --save @ionic-native/camera
$ ionic cordova plugin remove cordova-plugin-camera
Ensure that both cordova-plugin-camera
and @ionic-native/camera
are removed from package.json
.
Remove any references to the old Camera
object from all your source files.
Install the cordova-plugin-camera-with-exif
plugin
$ cordova plugin add cordova-plugin-camera-with-exif
Use it as follow:
// Declare the navigator instance
// The plugin will be injected into this instance
declare var navigator: any;
// Using the camera const cameraOptions = { quality: 40, destinationType: destinationType, encodingType: navigator.camera.EncodingType.JPEG, mediaType: mediaType, sourceType: sourceType, correctOrientation: true }
launchCamera() { function onSuccess(result) { // convert JSON string to JSON Object var thisResult = JSON.parse(result);
// convert json_metadata JSON string to JSON Object
var metadata = JSON.parse(thisResult.json_metadata);
}
function onFail(message) {
alert('Failed because: ' + message);
}
navigator.camera.getPicture(onSuccess, onFail, cameraOptions);
}
6. Remove and re-add platforms
$ ionic cordova platform remove ios $ ionic cordova platform add ios
7. Build target
$ ionic cordova build ios
Thanks!
Since there isn't an @ionic-native/camera-with-exif version of this, how do we install this in an ionic 3 app?