I want Ignition to display an image from a local directory. In vision, I was able to do it as below:
The same path string does not work on a Perspective Image component when entered to props.source field:
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:
- 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.
- 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.
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.
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”.
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)