[Perspective] Auto Refresh Hosted Image

I have a system where I don't have access to OPC, but I want to host all the C-more EA9 HMI screens on an Ignition screen. I'm using an image component in Perspective to load the images via a URL, like http://IP-ADDRESS/3.jpg.

The issue I'm facing is that there's no way to refresh the image. The C-more will generate the latest screen when a GET request is called, but I have to manually refresh the page to get the updated image. I've tried using a unique URL and the refreshBinding function, but neither worked. When using a ? in the link, it returns an encoded string instead of the image.

The refresh rate doesn't need to be high—every 5 to 10 seconds would be sufficient to display the latest faults across all devices.

You could fetch the data with scripting (system.net.httpClient), then render it to a data URI and put that into the actual Perspective page. Not super efficient, and if you have many clients you should batch the work so that the gateway only hits the HMI(s) once, but it should work, since it'll be a fresh HTTP call each time.

On this stream, I have done this with a scheduled script on the gateway grabbing the image once every 5 seconds, base64 encoding it and throwing it in a memory tag, then the binding of the image item bound to this will change if the tag changes. Bear in mind that the images will be quite small as they are coming from very small HMI resolutions, so this will not be the worst performance hog.
This solution effectively caches the image in the gateway and lets the server organise the updating and sync.

2 Likes