Refresh image in Ignition perspective

Hello, I have questions about display images in Ignition Perspective. I am setting the source for an image component to: "https://server_name/main/screens/NewImage.png". NewImage is constantly updated on remote server. But in Perspective session image component continues to show original PNG and update new only when I refresh webpage. Is it possible to update the image displayed in perspective without refreshing the page?

1 Like

Add a variable to url with a changing value like milliseconds. https://server_name/main/screens/NewImage.png?v=1984355000

1 Like

Yep I do the same thing on PDFs with an expression

concat(
'http://testsite/003430.pdf?t=',
now(0)
)

I add a variable to url with changing value, but this doesn't solve me issue. Still the image does not refresh on the perspective screen. But I noticed that when i right click on the image and select open in new tab, the most recent image opens.

I don't really like this method, but you could try setting the source to '' then back to the correct source string and see if that forces a reload. However, I think the url with a time parameter should work. How did you set it up?

Was this ever solved? I have a database with an image that is being monitored. It updates every 5 minutes. The url on the image does not change. Only way to refresh the image is to reload the page.

You usually can include "throwaway" URL query parameters that are present solely to force a refresh. In your perspective session, you could use an integer session custom variable that increments when the image changes. Image components would include that var in an expression that constructs the URL.

1 Like

Thank!. So I ended up doing the variable JPark recommended.

Added this variable to the image url. Worked!
'&v='+toMillis(now(10000))

That's going to hit your database every ten seconds for something that changes every five minutes. That's a lot of extra traffic. :frowning:

1 Like

Changing to 5 minutes 10 seconds was just for testing. :slight_smile:

So you're ok with it updating as much as 5 minutes late? Using now() to produce a timestamp as the throwaway URL parameter is a terrible technique.

The throwaway param should be something that only changes when the image actually changes in the DB. And should be something identical across all sessions and tabs that look at that image, so that all other caching operaitons work like they should.

Do you control the image getting into the DB? Does each user look at a different image source? Or shared?

1 Like