questions about image entity

0
Hello Experts,   There is a functionality in my App: The users want to upload some images to the app, then the app will send these images to another system for analysis and saving. I have 2 question about this user scenario: 1. Actually, my app will not store these images into my database, so I don't want to use persistable entities for these images, but seems I can't choose non-persistable when I set generalization from System.Image, so how can I set the entity for these image? 2. When I use Base64 encode file to  convert image to a string, and send this string to target system via rest API, but the target system can't convert this string back to a image, can anyone tell me why and how can I deal with this problem? is there any sample I can   
asked
3 answers
0

Hi Jianfeng Wang,

     In mendix you can't use np entity for image, for this you can use persistable entity as like helper if it matches your criteria then move to main entity else delete the object in Helper entity.

     Instead of using base64 you can use form data in REST Call to send and receive file in another app

answered
0

Hi Jianfeng Wang,

 

1. Delete the image once it is sent to another system via Rest API; for backup purposes, you can store the base64 image in another entity. 

 

2. See if your system will accept binary data; if yes, send the content using export mapping.

 

Hope it helps !! 

answered
0

Hi Jianfeng,

You can't use NP for image entity.

Do one thing first upload your image & in the microflow convert this image in Base64 using javaAction -> return this string or send this string by API(send only converted string instead of object) & don't commit your image object here.

 

Go to your another app or where you are consuming this by API -> Make a nanoflow -> inside this nanoflow take a activity Base64Decode To Image -> pass your Base64 string & select an image object to store this image in your new app & commit the object to keep in DB in your second app.

 

Screenshot 2025-03-08 022857.png

 

Screenshot 2025-03-08 023239.png

I hope your like the answer

answered