[Question] Loading images from gateway's file system

<Edit>
The proposed method of placing files in the main directory is not officially supported and could stop working at any point in the future. The only officially supported first-party route for serving files is use of the WebDev module.
</Edit>

I had a conversation with development just to make sure I was on the same page as them and here are your options:

  1. Move any content you want to share publicly into a directory structure within Inductive Automation\Ignition\webserver\webapps\main\.
  2. Use the Web Dev module to mount your own folders of content

I'll cover the first option because I'm more familiar with that route.

Assuming your images/svgs are in a folder structure starting with "Files" and there is an image named my_image.jpeg in the "Files" directory (such that C:\Files\my_image.jpeg is a real file):

  1. Move the Files directory to C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main so that you have C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main\Files\my_image.jpeg.
  2. Place an Image Component in a View.
  3. Set Image.props.source to "http://<gateway_ip>:<gateway_port>/Files/my_image.jpeg".
  4. Done.

The short story of why we don't allow for you to just point at C:\Files\my_image/jpeg is Security. suppose you had C:\Personal_files\2018_tax_return.pdf on the file system... Well, if we allowed for just pointing components at any old directory, then nothing would be safe.

4 Likes