# Validating if image present in a Image Library in Perspective

**URL:** <https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849>\
**Category:** Ignition\
**Created:** [January 10, 2022, 9:26pm UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849 "2022-01-10T21:26:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tpile](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@tpile](https://forum.inductiveautomation.com/u/tpile)\
**Post date:** [January 10, 2022, 9:26pm UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849/1 "2022-01-10T21:26:55Z")

</div>

I have an image library that is suppose contain an .jpg image for every users that can run my Perspective Project. I am using a Property binding with a Transform Script for the source to which evaluates to “/system/images/IDPhotos/userName.jpg”. This works fine if there really is a userName.jpg in the image library. The problem is that there is not always userName.jpg for all users. Does anyone know how to check an image library to determine if an image exists in the library via my binding script so I can load an alternate image if my userName.jpg does not exist?

---

<div class="post-metadata">

**Author:** ![andrewbrown](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@andrewbrown](https://forum.inductiveautomation.com/u/andrewbrown)\
**Post date:** [January 10, 2022, 9:56pm UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849/2 "2022-01-10T21:56:46Z")

</div>

Have you looked at storing the Images as a blob in an SQL table and producing the image that way? Doing it this way it will be simple to filter which is available and which isn’t…

This isn’t to say there isn’t a way to complete this in the way you are saying, but the other way definitely works the way your describing.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 10, 2022, 10:26pm UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849/3 "2022-01-10T22:26:22Z")

</div>

There’s no readily available way to query the image management system. If you want to do something dynamic like this, I would echo @andrewbrown’s suggestion to migrate to a DB-based approach.

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [January 10, 2022, 10:53pm UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849/4 "2022-01-10T22:53:06Z")

</div>

Would checking if the file exists work for you?  
[https://docs.inductiveautomation.com/display/DOC81/system.file.fileExists](https://docs.inductiveautomation.com/display/DOC81/system.file.fileExists)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 10, 2022, 11:14pm UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849/5 "2022-01-10T23:14:57Z")

</div>

`fileExists` is for the local filesystem, won’t help with images in image management.

---

<div class="post-metadata">

**Author:** ![jespinmartin1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jespinmartin1/32/57175_2.png) [@jespinmartin1](https://forum.inductiveautomation.com/u/jespinmartin1)\
**Post date:** [January 11, 2022, 5:54am UTC](https://forum.inductiveautomation.com/t/validating-if-image-present-in-a-image-library-in-perspective/54849/6 "2022-01-11T05:54:17Z")

</div>

This is ambiguous for me, is `“/system/images/IDPhotos/userName.jpg”` a resource from WevDev Module?  
If so, solve it with an http binding. Trivial.

If the source is from Image Manager, is also simple to solve with the [ImageManager](http://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.1/com/inductiveautomation/ignition/gateway/images/ImageManager.html) and with a couple script lines.
