Image manager - storing images dynamically

ok, the image is displaying in a URL, but not on the page. So i guess I am linking it incorrectly.

1 Like

@Noah_Casey thank you for your code.
I added, in relation to the image management tool:

  • image deletion
  • Retrieve the list of images and put it in a dropdown
  • Displaying an image from a dropdown

ImageManager_2024-06-17_1247.zip (34.4 KB)

To retrieve the list of images I haven't found a clean thing to do but it works!!!
I use the "getImages(String dir)" function of the "ImageManager" object, I retrieve a list of "ImageRecord" but I cannot properly retrieve the path. So I get the string of each ImageRecord and I cut what I don't need....Anyway, if anyone knows how to do it, I'm interested!!!

from javax.imageio import ImageIO
from java.io import ByteArrayInputStream
from com.inductiveautomation.ignition.gateway.images import ImageManager, ImageFormat
from com.inductiveautomation.ignition.gateway import IgnitionGateway
 
# Obtain the GatewayContext
gatewayContext = IgnitionGateway.get()
# Get the ImageManager
imageManager = gatewayContext.getImageManager()
	
directory = self.view.custom.directory
ImgList = imageManager.getImages(directory)
	
options = []
 	
for img in ImgList:
	if str(img)[:13] == "[ImageRecord ":
		options.append({ "value":unicode(str(img)[13:-1]), "label" : unicode(str(img)[13:-1])})
1 Like

@Thomas_Salisbury

:mage:
You can store images (or any files) for perspective here:
C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main

and access them with /image.png or http://example:8088/image.png

Note that the browser might cache these images, so if you plan on modifying one certain file often you will have to change its name.

You can not that easily delete them though (on windows), because java locks them, but i got something for that here.

3 Likes