Embedding a Front Panel Image in an Existing HTML Document

National Instruments recommends you use the Web Publishing Tool to create an HTML document and embed static or animated images of the front panel or to embed a front panel in an HTML document so a client computer can view and control the front panel remotely.

However, if you already have an HTML document, complete the following steps to embed a static image of a front panel in the existing HTML document. Store the HTML document in the Web Server root directory. Refer to Web Server Syntax Examples for examples of embedding VIs in HTML documents.

  1. Copy the following HTML code into the existing HTML document:

    <IMG SRC="http://web.server.addr/.snap?VI_Name[&type=png][&depth=24][&quality=80][&compression=1][&refresh=60][&full=off]">

  2. Replace web.server.addr with the address of the LabVIEW Web Server.
  3. Replace VI_Name with the name of the VI.

    A question mark separates the URL from the VI name. Parameters in brackets [ ] are optional.

  4. (Optional) You can add the following parameters to specify attributes for the image.

    ParameterDescription
    VI_Name Name of the VI front panel to view. VI_Name is the top-level VI in stand-alone applications. Encode the VI name according to standard URL naming conventions. For example, replace non-alphanumeric characters with %xx, where xx is the hexadecimal value of the character. You also can use a plus (+) sign to replace spaces.
    type Image type, either PNG or JPEG. If no type is specified, the default is png. If the browser does not support PNG, the default is jpeg.
    depth Depth of the color in the image. depth can be 1, 4, 8, or 24 bits. If no depth is specified, the default is the color depth of the monitor.
    quality Image quality and memory size of the JPEG front panel image. This parameter is applicable only when type is jpeg. quality can be between 0 and 100. If no quality is specified, the default is 80.
    compression Compression level used for compressing PNG images. This parameter is applicable only when type is png. compression can be between –1 and 9, where 0 indicates no compression. 1 indicates less compression, but faster speed, and 9 indicates high compression, but slower speed. Compression levels 3 through 6 perform as well as level 9 and perform fewer calculations than level 9. If no compression is specified, the default is –1, which uses best combination of speed and compression.
    refresh Maximum age in seconds of a cached image. If a cached image is older than refresh seconds, a new image is generated.
    full Specifies whether to return the image of all controls or just the part visible in the window. Set full to on to indicate all controls and off to indicate the window content. If no full is specified, the default is off.

To view the front panel image, type the IP address or computer name of the server followed by the name of the HTML file in the URL of a Web browser. For example, http://ipaddress/filename.html.

Note  To display VI front panels on the Web, the VIs must be in memory on the computer.