I'm testing now TIMAI2's extension.
Understood.
If you want to store the images as base64 then you could do this:
- Take your Picture
- Set an Image component to the output size you want, e.g. 400x300 (it does not have to be visible)
- Set the taken picture "image" to the image component
- Use this extension to convert the imagePicture to base64
- Store the base64 string created to your sqlite record (you will need a TEXT field for the base64 string)
hmm, just been testing, extension does not appear to be working in companion for some reason!
Yeah, that's what I'm looking here too... companion stops working. Maybe I have to test with APK.
Give me a little while....
Ok, thanks for your time!!!
Nope, working OK, just having a senior moment!
Blocks like this:
Don't try to load base64string to a Label, this may be causing the companion to stop.
Great!!! All working ok here. This is my result:
Now my problem is another one. But I will open another post.
Thank you!!!
Just complementing my results... the Base64 string generated was saved, but it is too big. When I try to access the field (TEXT type) the app has to wait almost 30 seconds to react... That's why companion is stopping (I've tested with APK). I think I need to compress (or reduce) the image before converting to Base64...
OK, seems we are not getting the expected outcome....
Try this way.
You will need my Image Convertor extension and @Juan_Antonio 's KIO4_Base64 extension (so we can use the FileToStringDirect block).
This will resize the file 400 longest side, generally taking a 3mb original camera image down to @ 100kb, which should be much more manageable.
Blocks like this:
note: this overwrites the original image, so use a different output path if you want to retain the original.
Ok, I'll try again and tell you my results.
Thank you!
Ok, now the app is not slow and not stopping, at least in APK. I'm going to test using companion and see..
There is another way, using the procambase64 extension
theprocamwayto64.aia (34.3 KB)
This takes a preview (thumbnail) picture instead of the full camera image. Is going to depend on your needs and final image quality. if only viewing on phones, and you do not need fine detail, this might be all you need in terms of size/resolution.
Great, my friend. Thank you again!! I'll try this way and see which result is better.
Regards,
Well, this is my results: Everything works as expected. About resizing the image, etc. Now I am saving the base64 string into a sqlite field (TEXT type) and the app does not stop, even in companion:
Now my problem is when I send the image to a MySQL remote server. But this is another subject.
Thank you @TIMAI2 for your guidance and help.
Read this topic:
Thank you again @TIMAI2 Yes, I’ve read this. The doubt is when the source is from a SQLite text type field.
You will need to get the base64String from sqlite, then upload this to your mysql server
or
send it to your mysql server more or less at the same time you store to your local sqlite server, along with any associated data (e.g. filename / extension...)
That’s what I am doing. In my PHP script, I am receiving the data and using base64_decode to store in a blob field. It stores but the image in mysql is just a black image
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.