IFrame with Image and Text in HTML

I am currently experimenting with the IFrame and had a question regarding displaying local images through HTML. My HTML I am putting into the src is the following:

data: text/html, <BODY><H1>  <CENTER><IMG src="C:\test\static\ref_212.jpg"></CENTER></H1>  <P align=left>  <P align=left>  <P align=left>  <TABLE id=editnumber cellSpacing=2 cols=2 cellPadding=1 width=107 border=4>  <TBODY>  <TR>  <TD>Edit </TD>  <TD>621</TD></TR></TBODY></TABLE></P>  <P><BR></P> 

I get a broken image link but if I were to save that as an HTML file and open it it would find and display the image.

I’ve gotten a web linked image to work so I know the source should be all set up correctly, my question is is Ignition able to access local images at all or am I just trying to access it incorrectly.

Thank you in advance!

Everything in Perspective is run on the Gateway computer. If that file exists on the client computer, this won't work, full stop.

1 Like

Gotcha, if I were to move those images to somewhere within the gateway would I be able to access them?

My best answer is maybe. Hopefully someone more familiar with this component will come along to give a better answer. I would try it and see.

1 Like

The short answer is no.
Browsers won’t allow you to view local file resources and network file resources at the same time, for security reasons.

You need to use some webserver to host the files. This doesn’t have to be Ignition, but should be on the same host (otherwise you get cross-domain resource issues from browsers).

The easiest solution is to use the Webdev module. You can host specific files or ‘mount’ certain folders so that Ignition’s webserver will make them available over the network: Web Dev - Ignition User Manual 8.1 - Ignition Documentation

Thank you, the model that is currently being used to do this task is using a python webserver, and if I poach just the image by replacing the source with a link like this: “http://localhost:XXXX/test/static/ref_212.jpg” I am able to get the image to show up in my perspective designer session, and after a little bit it shows up on the client. I’ve never used anything like this before haha but thanks to your insight I think I can just strip down the webserver to just hold the images as everything else worked except that.

Not the most efficient way probably, but was told for this implementation they’d prefer not to use the webdev module so this is a start.

What? No way that is easier than my Blob Server Module.

2 Likes

Hey, I’ve been on vacation for three weeks, and now you expect me to remember third party modules too? I barely remember all the first party ones :slight_smile:

2 Likes

If they're mine, of course!

1 Like