Mendix Native - Base64 to Image entity

0
I am working with Mendix native and encountered the following problem:   I have a button on a page with a on-click nanoflow that calles a microflow, in that microflow I have a Image entity, I want to return this Image entity to the nanoflow, but since you cant return a Persistable entity to a nanoflow i need to do this in other ways. I tried to use the CommunityCommons java action called "Base64EncodeFile" in the microflow, then return the base64 string to the nanoflow and then execute the NanoflowCommons javascript action called "Base64DecodeToImage" but this image wouldn't be visible in the dynamic image widget. The image does display when I enter the base64 in a browser, so it seems like the base64 is valid.   I would like to hear if anyone has encountered this issue and has any suggestions, thanks in advance!   *I already tried this* Executing the sync to device activity for the Image entity in the microflow and then retrieving the image from the database in the nanoflow works and it displays the Image in the Dynamic Image widget. But with this solution you have to commit to the server database and that is something we have to avoid in our app.   Greets, Faycal
asked
1 answers
3

Images are always auto-commited to the server database, so you won't avoid it passing through the database this way. The only way to avoid the database would be to never use the image entity. Keep in mind however that base64 strings can be rather large and will take up a lot of server memory. Often only using the database for passing information along is quite acceptable, so deleting the image after the sync to device might just be ok.

answered