react-native-image-base64 icon indicating copy to clipboard operation
react-native-image-base64 copied to clipboard

In IOS, image is not getting converted to base64

Open purvotara opened this issue 7 years ago • 4 comments
trafficstars

Hi,

Thanks a lot for the wonderful work. In the android, conversion is working fine(Can you please add the permission check, if the read external storage is not given), but in the IOS conversion is not at happening. It's giving data as undefined. I mean base64String is undefined in IOS.

 imgToBase64.getBase64String(images[random].uri)
          .then(base64String => {
           
            console.log(base64String)
            this.navigateToResult(shareImageBase64);
          })
          .catch(err => console.log("Error in ImgToBase64", err));
      })

Could you please help in solving the issue.

Regards, Sharath

purvotara avatar Jun 24 '18 15:06 purvotara

Same problem here in react-native version 0.60.2 Showing error: setUpDeveloperTools.js:73 Possible Unhandled Promise Rejection (id: 0): TypeError: Cannot read property 'getBase64String' of undefined TypeError: Cannot read property 'getBase64String' of undefined

gilshaan avatar Nov 04 '19 11:11 gilshaan

I used another package: react-native-fs import RNFS from 'react-native-fs'; var data = await RNFS.readFile( "file://path-to-file", 'base64').then(res => { return res }); This works fine.

gilshaan avatar Nov 11 '19 07:11 gilshaan

@gilshaan While that does work, it is a very heavy library to import if you simply want a base64 image.

@purvotara Have you got a reproduction step with a supplied image?

micnguyen avatar Aug 09 '20 05:08 micnguyen

I used another package: react-native-fs import RNFS from 'react-native-fs'; var data = await RNFS.readFile( "file://path-to-file", 'base64').then(res => { return res }); This works fine.

How to use with https url.Its not working.

TaraSinghDanu avatar Aug 17 '20 17:08 TaraSinghDanu