I have a PNG image in a byte and, using the web player, I want to display it in a new window or tab.
I think I can do this by using Application.ExternalCall
, but I’m not a web developer and don’t know how to do the web code to display the image. So, is there another way to do this? Or point me on how to do the web code?
Check this answer for how to open a new tab from within the web player. To load an image from a byte array in a browser you can use the Data URI scheme, e.g.
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
Pasting this in your url will display a simple image, using base64 encoding.
Not sure what format your byte array is in but you may have to convert it first. Perhaps using something like the C# ToBase64String function?
So combining this you could try:
var image_url = "data:image/png;base64," + YourByteArrayString; //-- add your byte array here..
Application.ExternalEval("window.open(image_url,'_blank')");