Disable perspective image component cache

Hi

I try to load a different image from “Inductive Automation\Ignition\webserver\webapps\main” but when i change the old image with the new one the image component only loads the old one.
If I open the page in new browser for the first time it is ok and cache it forever.
Is there any way to disable the caching system of this component?

This is either up to your browser or the (undocumented, unsupported) inadvertent Jetty webserver hosting mechanism.

That said, you could try a classic lazy strategy; make the source path dynamic by appending a nonsense query parameter, e.g. add a binding like this:
"path/to/image?q=" + toMillis(now(0))

1 Like

Thanks, Paul,
I just face another problem, when I upload a file in the gateway file system the next time I want to upload and overwrite the file I get this error which file is open and used by java.exe.

> java.io.FileNotFoundException: java.io.FileNotFoundException: webserver\webapps\main\User Image\nader.png (The requested operation cannot be performed on a file with a user-mapped section open)

I simply want to save user profile pictures and user can change their user profile picture.

	basePath = 'webserver/webapps/main/User Image/'
	extension = event.file.name.split(".")[-1]
	username = self.session.props.auth.user.userName
	event.file.copyTo(basePath + username + "." + extension)

Yes. That’s a known issue with the webserver/webapps hosting.

It’s also, and I can’t understate this, not something we care to fix. The webserver/webapps hosting method only works by accident. It is not something we explicitly support or guarantee to work between versions.

If you want to expose a folder via Ignition’s webserver, use a Webdev mounted folder.

1 Like

Is there any option to use image management instead?
Can I push image file into it by python?

sorry im on lunch break xd

beginner dev: it doesnt work. :confused:
intermediat dev: it works somehow, no idea how. :thinking:

bethesda dev: it clearly works and that is a feature not a bug :lying_face: :crazy_face:

pro dev: it works. :face_with_monocle:
igntion dev: it works and this random features does too. :exploding_head:

3 Likes

You can, but it's going to take some doing via scripting.

The preferred method to have dynamic input/output of images would be a database with BLOB columns.
If that's not an option, you can push whatever files you want into a Webdev mounted folder.
Image management has some performance concerns (by necessity, it's using the internal DB that's also responsible for all of Ignition's configuration - the more contention you can avoid on the IDB, the better) that mean that I'd avoid it for particularly busy systems.

But I saw in one of your post that using BLOB and converting it to base64 and bind it to image SRC cause performance issue specially for desinger.(put a lot of chars in the SRC property)
I already did that method for small images but Im looking for best option.

The best option (in my opinion) would be a proper webserver connected to a DB to store images, with its own caching mechanism, on the same host as the gateway, behind a reverse proxy so that external connections only see a single port.

You can get a lot of the benefits of that approach by using Webdev (a Python endpoint) attached to a DB. You’ll want to implement your own caching so you’re not always fetching each image from the database, but this could be quite performant.

I do think that there’s room for Ignition to make this better, and I filed a ticket internally a while back for us to do exactly that. However, it’s still incubating - we’re figuring out exactly what approach we want to take.

1 Like

Ahem:

{ /shameless plug }

2 Likes