I have an application with multiple sites. I want to be able to manage the logo that is displayed on the main screen according to which site is logged in. My thought is to link the image path to a SQL column in the DB table locations. This all works fine but I want to be able to manage which Image path is in the DB from within Ignition. How can I create an object which will browse the Image library and return the path so I can update the DB with it?
You won’t be able to browse the image library in the client. I would just force the images to be in a specific structure. For example, if you have three sites:
you can have a folder in the image library called logos. Inside of that you can have three images:
You know there are only three options. In the database you can create a table called sites that has 2 columns:
with 3 rows. You can bind a dropdown list to that table:
SELECT id, sitename FROM sites
When you select a site in the dropdown list you can use that name to store somewhere else. This is just an idea. You have to manage it yourself since you can’t browse the library.
Another option would be to actually store the image in the database rather than in the image library. This one is a little more work but it would allow the user to upload an image if it didn’t exist already. My example above requires the images to exist.