How to execute microflow/java actions on client, instead of server? - Mendix Forum

How to execute microflow/java actions on client, instead of server?

0

Is there a way to run a microflow (that contains specific java actions) locally on the client, instead of the server? 

The application in context has to sent images to the server, but due to bad signal and large images, this process could take quite some time. The images, however, don't need to be high-quality or big in resolution. Therefor I would like to crop the image before transfer, to save on bandwidth and upload time. However, the microflow that executes the java actions only takes 1 second to complete, but to kick off the microflow itself can, on a slow 3G connection, take up to 30 seconds, which pretty much seems it wants to transfer the big image file to the server first. I want to flip that order; resize first and then transfer.

Nanoflows don't seem to contain java actions (at least, 7.23.5 doesn't) and all my tries seem to run on the server..

asked
2 answers
0

Has to happen client side and a pretty good idea for a widget, try take a look at brunobar79/J-I-C (via stackoverflow.com) and implement

Basic implementation test

var jicb64=jic.compress(dojo.query('img')[1],30,'jpg').src;
var img=dojo.create(
    'img',
    {
        src:jicb64,
    }
);
var dlg=mxui.widget.Dialog()
dojo.place(
    img,
    dlg._bodyNode
);
dlg.show()

Results

Size comparison

C:\tmp>ls -l ./a.jpg ./b.jpg
-rw-rw-rw-  1 ockert 0 381923 2019-08-02 15:27 ./a.jpg
-rw-rw-rw-  1 ockert 0 101768 2019-08-02 15:32 ./b.jpg

 

answered
0

Hello Sander,

As far as I’m aware it's not possible to execute java actions or microflows on the client, at least not with out of the box Mendix. 

You can try and do the cropping in javascript which gets executed on the client.

Hope this helps.

answered