Image component showing old Images

Hello,

I’m using a script to update the image path and display it using an image component. The problem is that if the new image has the same name, it still displays the old image even though the old image is no longer located in that path. Is there a way to dump the cached image ? It has to be stored somewhere.

Clearing the Java cache should be sufficient for cached images:
https://www.java.com/en/download/help/plugin_cache.xml

Not sure if there’s a way to programmatically clear the Java cache within Ignition.

If this is related to your original problem here then I’d recommend rendering the image bytes instead of changing the path.

I figured it out. There is a Behavior property on the image component called “Use Cache” and it was set to true. unchecking it fixes the problem

2 Likes

Dear @hajaj.saleh, I cannot find the property on the image component on perspective.

Could anyone indicate where it is located? Or a easy way to update/refresh an image that is stored with the same name in the same location?

Thanks in advance,

This does not exist in perspective.

you could append the source with a “?string” /system/images/image.png?031120111017 but this kinda depends on the device/browser if it really will refrsh it or not… if you do this to often it will cause the users cache to be full which might delete things you would have rather kept.
Normally its not good to do this, better let the user clear their own cache.
Maybe add the date of last change wouldnt be to bad…

Thanks @victordcq for the reply,

I see your point.

But then, how do I refresh the image component. I am storing the picture (always with the same name because I do not want to keep the “old” versions) in the “C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main\myfolder” folder.

Then the source is easy: “/myfolder/image1.jpg”

I tried to refresh the source value of the image component in the “onFileReceived” action like this:

self.getSibling("Image").props.source = "/fotos/image1.jpg"

And of course is still showing me the old image, that is not in the folder anymore, but so in the cache.

I would like the image component to update or refresh smoothly.

Thanks,

How often does this picture gonna be changed?

The picture is uploaded with the file upload component. The user could add it or not.

image

The workflow would be:

  • The user checks an inspection list to verify that something in the product must be correct.
  • After the inspection, he could add (or not) a photo of something he wants to comment about or to zoom some special part.
  • Moreover, I have the image component to show the photo he just uploaded (from the camera i.e.). If he wants to replace that picture, he also should be able to do it (uploading a new one and refreshing the data on the image component).

I could not say a frequence value. Let´s say, i.e., 10 times per hour.

if you have control of the input, save a number (date?) somewhere (tag/db) when it was uploaded and append that to the source with a questin mark infront

self.getSibling(“Image”).props.source = “/fotos/image1.jpg?” + yourRefreshNumber