0

In my project I am retrieving gallery's albums using react-native-photos-framework which giving me gallery's album. Then using those album object I am fetching images of that particular album, which returning assets array. Those assets contains uri which look like this :

"photos://C5E8291B-09C6-2231-856D-989D929392FA2/L0/001"

How I can get the base64 string of that image.

I tried to get using react-native-image-base64 and react-native-fs but none of working.

Here is a code in which I used react-native-image-base64 :

const base64 = await ImgToBase64.getBase64String("photos://C5E8291B-09C6-2231-856D-989D929392FA2/L0/001");

But, this giving me following error :

JSON value '' of type NSNull cannot be converted to NSString

Here is code using react-native-fs :

const base64 = await RNFS.readFile('photos://C5E8291B-09C6-2231-856D-989D929392FA2/L0/001','base64');

Above code giving me this error :

"ENOENT: no such file or directory, open 'photos://C5E8291B-09C6-2231-856D-989D929392FA2/L0/001'"

Please help me how to solve !!!

Kishan Bharda
  • 5,446
  • 3
  • 30
  • 57

0 Answers0