I am using a signed java applet to load an image from the filesystem of the user.
Then I want to display this image in the website where the applet is running.
I know how to communicate between applet and JavaScript, but I only used strings and numbers as parameter.
How do I handle image objects and how do I display them on the website?
If required I can convert the format in the applet to match the JavaScript.
Edit:
I passed the Image object from java to javascript with a call from JSObject. Chrome ignores the call and Firefox crash..
You might encode the image as Base 64, pass it to JS as a String, and use the
data:image/gif;form URL to display it in the web page. You’ll need to ‘roll your own’ base 64 encoder or find an API, since the J2SE has no inbuilt method for the conversion.1It might look something like this in the HTML.
E.G. taken from Inline Images with Data URLs.
DatatypeConverter.printBase64Binary(byte[])something like this: