SnappFr / react-native-image-base64

Simple react native library to convert an image to a base64 string 🌄
MIT License
49 stars 28 forks source link

What does it mean to take as an input file:// ? #5

Closed lnghrdntcr closed 6 years ago

lnghrdntcr commented 6 years ago

Noob here, I can't understand how to use file://. Should I be giving it the full path (/home/user/...), the project path relative to the root of the project (src/images/...) or the relative path from the component in which I call the function?

Michaelvilleneuve commented 6 years ago

Hi, none of the above, the input file must be a file saved on your app storage. IOS and Android won't read you relative or absolute computer path, instead they will look on the user's device.

lnghrdntcr commented 6 years ago

Thank you for your answer! So I should be saving first the image to the local storage and than converting it to base64!

Michaelvilleneuve commented 6 years ago

Yes exactly ! But in your case, if you already have the image in your development folder, why would you need to convert it ?

Usually we use this lib to convert an image taken by the camera, meaning not initially in the development folder.

Anyways, if that is your need, you can use react-native-fs to save the image to your storage :)

lnghrdntcr commented 6 years ago

Thank you for your support! I'll close the issue.