phonegap-base64 icon indicating copy to clipboard operation
phonegap-base64 copied to clipboard

Image File URI does not converted in IOS

Open busrauman opened this issue 6 years ago • 9 comments

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}

busrauman avatar Apr 03 '18 13:04 busrauman

Are you fetching the image through Camera/Gallery ?

tejaskutal avatar Apr 10 '18 06:04 tejaskutal

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); });

busrauman avatar Apr 10 '18 06:04 busrauman

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.

tejaskutal avatar Apr 10 '18 07:04 tejaskutal

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

busrauman avatar Apr 10 '18 07:04 busrauman

Coz it's been in 'beta' stage since like forever :/

tejaskutal avatar Apr 10 '18 07:04 tejaskutal

thank you for your advice and time :)

busrauman avatar Apr 10 '18 07:04 busrauman

Anytime. In case you find a solution to get base64 from the image URI, please post it here. I need it too :)

tejaskutal avatar Apr 10 '18 08:04 tejaskutal

Ofcourse, if i find anything i will share here:)

busrauman avatar Apr 10 '18 19:04 busrauman

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)

austinhutchison avatar Jun 20 '18 19:06 austinhutchison