Display local image file in Perspective

Hi All,

I want Ignition to display an image from a local directory. In vision, I was able to do it as below:
Vision_Image

The same path string does not work on a Perspective Image component when entered to props.source field:
Perspective_Image
Perspective_Binding

My test was done on the gateway machine, so both Perspective and Vision should have access to the image file.

Appreciate any suggestion.

Browsers generally do not allow web resources to access local files. Other than through user-controlled upload forms. Because that would be a huge security hole. Vision runs as a local application, so it is trusted with local resources.

As @pturmel said, it's all about what Perspective (ie: browser) has access to. If you want an image file to be displayed in Perspective, there a re a few options, but these are the two easiest:

  1. From Tools > Image Management, you could upload a file to the internal database, and then in the image component supply a source of '/system/images/path_to_image/filename.extension". This solution is not the best if you expect to need many photos, as it will slow down the internal database.
  2. Place photos you will need in
    C:\Program Files\Inductive Automation\Ignition\webserver\webapps\main, and then refer to them by setting Image.props.source to "path_to_image/filename.extension". This method allow for many photos without adverse effects on the internal database. Important note: This approach is not officially supported. It works only because of how the internal server settings of the Gateway work. At any point in the future, this may cease working and would be considered neither breaking behavior nor a bug. Use this route at your own risk.
6 Likes

When attempting to implement option 2 here Im not getting anything in the image viewer. Am I doing something wrong? I’ve tried with and without quotes for the file path.

image

Just use /lion.jpg

4 Likes

Is meant to be understood as "the path to the image within the main directory, followed by a slash, followed by the name and extension of the target file".

1 Like

In case anyone else stumbles on this post: I needed to use /path_to_image/filename.extension. It wasn't working for me until I added the leading forward slash (running 8.1.27)

1 Like

You have to add the forward slash for it to work.