Validating if image present in a Image Library in Perspective

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?

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.

1 Like

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.

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

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

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 and with a couple script lines.