![]() |
In order to publish the image of a VI using the LabVIEW web server, the VI must be in memory (and the web server must be turned on and correctly configured).
The LabVIEW web server uses the .snap? URL to publish panel images. The .snap? is followed by the name of the VI (encoded according to URL rules).
For example, if you have the VI with the name Chart.vi loaded, you can type the following text in your browser's URL field (replace host.domain.com with the Internet address of your own computer):
http://host.domain.com/.snap?Chart.vi
The LabVIEW web server will then return the image of the Chart.vi's panel:
It may not be enough to simply see the image of your VI in the browser. Usually you want addition text (maybe explaining what the image represents). In this case you'll want to embed the URL link of your VI image in an HTML document.
Most HTML editors allow you to insert an image and then specify the image's source URL. Simply type the appropriate URL as described above into the image's source (or SRC) field.
If you are editing HTML by hand, the tag for the image above can be either one of the following:
<IMG SRC="/.snap?Chart.vi">
<IMG SRC="http://host.domain.com/.snap?Chart.vi">
The first example is using a relative URL to describe the location of the image. It can be used when the HTML document and the VI image are both published by the same server.
The second example is using a full URL and can be used in HTML documents that are publish by any web server.
The LabVIEW web server can also publish animations of VI images. Use the .monitor? URL to retrieve animations of VI images. The .monitor? URL follows the same rules as the .snap? URL. However, if you embed an animated image in an HTML document, it will only be animated in Netscape Navigator. In other browsers will receive a single image.
Read the User Manual for more detailed information on URLs of VI images.
Often the front panel of your VI may be quite large, especially if you use a huge high resolution monitor. When the web server receives a request for an VI image, it must capture the contents of the panel's window, convert it into an image format and then send it back to the browser. The larger the window is, the longer it takes the server to create the image, thus slowing down the execution of your VIs. Additionally, a large picture will take significantly more time to transmit to the browser, especially over a slow modem connection.
It is a good idea to keep the panels of VIs that you plan to publish on the Internet fairly small. You may want to have a large VI that is seen by the operator of your application (and that contains buttons and other controls), and create a second, smaller VI that only contains relevant display information and that you use for publishing on the web.
© National Instruments |