JavaScript JPEG ArrayBuffer to Outsystems Binary Data

I have read a locally stored jpeg image using:

reader.readAsArrayBuffer(file);

and in my reader.onloadend = function() {..} function I have the resulting ArrayBuffer stored in reader.result.


On my mobile screen, I have an image with Type set to Binary Data and Image Content set to a local Binary Data variable (initialized to null) called "imgData".  


How do I assign this.result to imgData so that my image will appear on the screen.  I tried a naive assignment of this.result to imgData, but that does not work.  I checked and I know the ArrayBuffer has the data, and it has a jpeg mime type.


Hi John,

You can check this component for some hints on how to manipulate BinaryData on mobile.

Hope this helps!

Hello 

A possible alternative. 

Can you try using the FilePlugin  to read the file and get the binaryData and do the rest like you have mentioned. 

Solution

Thanks for the replies. I've tried using the FilePlugin but could only get it to recognize folders and files that were created by the FilePlugin itself.  I couldn't get it to see files created by my custom plugins or in the Cordova iOS folder hierarchy.


I was finally able to get my issue resolved by cannibalizing some of the Javascript code in the GetFileUrl javascript block in the GetFileUrlFromUri function in the FilePlugin, though.


I still don't know why the FilePlugin wouldn't recognize my data files though.


Solution