# Image manager - storing images dynamically

**URL:** <https://forum.inductiveautomation.com/t/image-manager-storing-images-dynamically/91770>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [June 12, 2024, 6:04pm UTC](https://forum.inductiveautomation.com/t/image-manager-storing-images-dynamically/91770 "2024-06-12T18:04:24Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![Thomas\_Salisbury](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/thomas_salisbury/32/62046_2.png) [@Thomas\_Salisbury](https://forum.inductiveautomation.com/u/Thomas_Salisbury)\
**Post date:** [June 13, 2024, 12:25pm UTC](https://forum.inductiveautomation.com/t/image-manager-storing-images-dynamically/91770/21 "2024-06-13T12:25:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![MaximePuntis](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@MaximePuntis](https://forum.inductiveautomation.com/u/MaximePuntis)\
**Post date:** [June 17, 2024, 11:09am UTC](https://forum.inductiveautomation.com/t/image-manager-storing-images-dynamically/91770/22 "2024-06-17T11:09:15Z")

</div>

@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](https://forum.inductiveautomation.com/uploads/short-url/5bVVF5cBUkq7MHP1GVgh0KpoBhH.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!!!

```python
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])})

```

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [June 17, 2024, 11:49am UTC](https://forum.inductiveautomation.com/t/image-manager-storing-images-dynamically/91770/25 "2024-06-17T11:49:19Z")

</div>

@Thomas_Salisbury

> [@Thomas\_Salisbury](#):
>
> unless someone know a magic folder that can be viewed in [http://example:8088/image.png](http://example:8088/image.png)

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

> [@Pdf viewer and source path](https://forum.inductiveautomation.com/t/pdf-viewer-and-source-path/53487/4):
>
> hm seems to not update refs when put directly in the root… try putting it in the folder main C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main it works with the same source url

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.

> [@Unblock and Delete files that have been locked by Java](https://forum.inductiveautomation.com/t/unblock-and-delete-files-that-have-been-locked-by-java/60194):
>
> There is an issue with java locking files that are in use. Mainly when using the webserver. Causing it to be impossible to delete them while the gateway is running. But here is a solution! (For windows atleast). Using handle you can find and unlock files. I made it a bit easier to use by writing a simple bat file. [UnlockAndDelete.zip](https://forum.inductiveautomation.com/uploads/short-url/7eEcAE6JGpz4JvjlyqUCP4CCD1X.zip) (891.3 KB) Unzip on the pc in the gateway (in for example C:\Folder) You can execute this through script or in the cmd line, requires admin rights! script: …

[Previous page](https://forum.inductiveautomation.com/t/image-manager-storing-images-dynamically/91770.md?page=1)
