I am making a chat app, when user add a new friend, both sides exchange their image URL (of Cloudinary) through firebase. Problem is when the user have many friends the app has to download many images from Cloudinary when the app is opened, so the images cannot display immediately, plus when the user use the app offline (to read old messages) the images cannot display.
So I think I will convert image to base64 format by some web API and store in the device, but how to display image which is stored in base64 format without internet ?
If you’ve encoded an image in base64 then you can just assign the encoded string to an image component and it will display it. Your base64 string should start with something like data:image/jpeg;base64,
Thank you very much for your kind @tatiang
You solved my question.
May I ask more for the next step in this post ?
Which web API can convert image URL (Cloudinary) to base64 ?
I have read many posts about it and tried the web API demo from @muneer and @actech but seem like all the web API were expired. They don’t give any response.
@tatiang Thank you very much for your suggestion, however this script is for encoding a text to base64, not an image URL to base64, right ?
I don’t know coding, so I cannot modify the script.
Could you or anybody please kindly help me about this ?
@muneer I tried already your demo by my mobile phones, it does not show the result. After I put image URL in the Text Input box and click the Get Base64 button, It shows error message in Label 1, please see below the screen shot of my phones.
@muneer I tried the Choose File button with 3 mobile phones, 1 is iPhone, 2 are Android phones.
Found result as below
After click the Choose File button, The iPhone ask me to choose from where to get the image; Take Photo, or Photo Library, or Search. While 2 Android phones do not ask, it go straight to Photo Library.
The iPhone can show Base64 text and Photo. However 2 Android phones cannot display them.
I tried the testing with png and jpg, both type of file give the same result.
Great results.
I created this to be a proof of concept and did not do a lot of checking, not even a progress bar. If you chose a large image file it will take time to upload it. for old phones this may take a lot longer to the point you might think it is stuck or not working.
Please select small image files such as icons which will allow old phones with low memory to give the expected results.
Apart for that, you have it working and now you can enhance the script to make it even better and faster.