after words base64; there is a Base64 string, which is an image. Just in string format.
I can make an API for you if you want
API? But even if you make an API, I will still have to upload an image to your server which will not make images upload faster, or I am missing something?
Oh, you wanted image to Base64…
I thought you were talking about Base64 to image
Yea, image to Base64. If anyone can make it, it would be amazing. @Mika you were searching ideas. This would help me a lot of, if you can make it.
You can use this extension :
com.ghostfox.SimpleBase64.aix (6.0 KB)
The extension has two simple functions :
Converts the image specified with the path to a Base64 String
Converts the Base64 String to an image that is displayed in the Image component .
Permissions needed : android.permission.READ_EXTERNAL_STORAGE to convert images from the external SDcard
If you need any other functions , please post here or send a PM .
Amazing job! Thank you! By the way, can you fix 1 issue? AfterPicture event (Camera’s component) gives a URI type of path: file:///mnt/sdcard/image.jpg. Ok, thank you for contributing to OpticalMath & community!
That is not an issue .
Just replace the text or use split at .
Ok, thank you! I tried to make this extension by myself, but I have failed! Thank you for great work again, @Sivagiri_Visakan I am sure that you in future gonna be the best extension developer . Because, you did make OAuth support thing.
You are welcome !
Thank you but I would prefer the term “one of the best” developers
There are many others who also work hard to make extensions !
Your extension doesn’t work.
My app stops responding.
Isn’t the path returned as file:///mnt/sdcard/image.jpg ?
If yes,then you have to replace
@Sivagiri_Visakan could your base64 decoded image be stored as a file and how?
Extension takes too much time to encode an image. My image uploads to Cloudinary faster than this extension encodes image. Also, if you use AfterPicture event & EncodeImage function, it will show black screen for 1minute (this happens while EncodeImage is encoding image). Users just gonna think that my app is lagging (not responding) and etc. Image to Base64 converter should take max of 3 seconds to convert img. Sorry, I cannot use it. By the way, users should not use this extension in production-ready apps. This extension needs a bit of more work.
Add function argument “Quality”.
compress(Bitmap.CompressFormat.JPEG, quality, baos);
So users could change quality, because if user compresses original image, it would take too much time. I prefer 50%
I will add this in the next version
I will see if I could bring out a fix and make it such that it doesn’t stop the app till the image is encoded .
Will add it in the next version.
Thank you all for your suggestions and patience.
Thank you. To add quality, simple add Quality parameter and change compress(Bitmap.CompressFormat.JPEG, 100, baos); to ompress(Bitmap.CompressFormat.JPEG, quality, baos);
@Sivagiri_Visakan, I found a simple solution to store image with tinyDB by means of your useful extension!
(here the image1 is only needed to confront the image picked with image saved in tinyDB and then shown in image2)
Does it not lag?
Yes ! It is indeed a great example ! Thank you for using the extension !
Like @ILoveThunkable asks, does it lag when you use the EncodeImage and DecodeImage function ?