phonegap-base64
phonegap-base64 copied to clipboard
Image File URI does not converted in IOS
I'm trying to convert from image file_uri to base64 but xcode return an error : errors encountered while discovering extensions: Error Domain=PlugInKit Code=13 "query cancelled" UserInfo={NSLocalizedDescription=query cancelled}
Are you fetching the image through Camera/Gallery ?
I'm fetching from camera and gallery with FILE_URI like that, this.camera.getPicture({ quality: 100, destinationType: this.camera.DestinationType.FILE_URI, sourceType: this.camera.PictureSourceType.PHOTOLIBRARY, encodingType: this.camera.EncodingType.JPEG, correctOrientation:true }).then(imageData => { console.log(imageData) }, error => { // this.error = JSON.stringify(error); console.log(error); });
You don't need the Base64 plugin then, you can simply change the below line from:
destinationType: this.camera.DestinationType.FILE_URI,
to:
destinationType: this.camera.DestinationType.DATA_URL,
This will give you the Base64 of the selected/clicked image directly.
yes i know, but i dont want to show image only , i need to upload remote server so i need file_uri i am using now normalizeUrl(path) to show selected image it works now, but i want to know why it doesnt work
Coz it's been in 'beta' stage since like forever :/
thank you for your advice and time :)
Anytime. In case you find a solution to get base64 from the image URI, please post it here. I need it too :)
Ofcourse, if i find anything i will share here:)
It's working for me, but I'm using the cordova-camera-plugin-with-exif
plugin.
I use
.getPicture({destinationType,1}).then(imageData...
,
then normalizeURL(imageData['filename'])
then this.base64.encodeFile(normalizedPath)