Using XML Configuration Files (*.xml)
FSI Viewer uses XML configuration files which can easily be edited with any text editor.
The default configuration file _default.xml
- which is located in /fsi/viewer/
is the most important XML configuration file
and will always be evaluated first.
To use FSI Viewer with additional configuration files you have to place the file in the /fsi/viewer/config/
folder
and provide the name of the configuration file using the cfg
parameter in the code:
<head>
//adding the fsiviewer.js script
<script src="js/fsiviewer.js" type="text/javascript"></script>
</head>
<body>
//Example with using a FSI Viewer configuration file:
<fsi-viewer width="500" height="600" src="/images/sample.jpg" cfg="sample_configuration"></fsi-viewer>
</body>
This will load the /fsi/viewer/config/sample_configuration.xml
file as the FSI Viewer configuration.
Configuration files are structured into configuration groups (XML nodes) containing parameter names and values.
Only parameters in these groups will be recognized by FSI Viewer. Configuration files do not need to contain all groups though.
Each parameter has to be provided as an individual XML child node of a group where the node name is the parameter name and the
parameter value needs to be provided as value
attribute of the node.
It is possible to implement viewer parameters in the XML configuration using specific viewer nodes, e.g.
<Viewer>
<TouchZoom>
<QuickZoom>
<Pages>
<Thumbbar>
This enables you for example to implement globally used FSI Viewer, FSI TouchZoom, FSI Pages, FSI ThumbBar or FSI QuickZoom
parameters in the _default.xml
or for certain viewers with an individual configuration .xml
file.
Structure of XML configuration files
<fsi_parameter>
<image>
<parameter value="" />
</image>
<viewer>
<parameter value="" />
</viewer>
<plugins>
<parameter value="" />
</plugins>
<options>
<parameter value="" />
</options>
</fsi_parameter>
Simple Configuration File
<fsi_parameter>
<image>
<path value="samples/Watch.jpg" />
</image>
<Viewer>
<skin value="silver" />
<debug value="1" />
<noNav value="true" />
</Viewer>
<TouchZoom>
<useDevicePixelRatio value="true" />
<enableByCSSClass value="zoom-image" />
<zoomPrecision value="3" />
</TouchZoom>
</fsi_parameter>
Please keep in mind the following rules when using XML configuration files:
- Attribute values must be provided in double quotes
- The last occurrence of a given parameter will be used
- Configuration files might be cached by your browser, so that changes in these files require flushing the browser cache. This does not apply when using the debug mode.
- Make sure to save configuration files in UTF-8 format if your configuration file contains language specific diacritics, Japanese characters and alike
You can comment on or disable sections of an XML configuration file using the usual XML comment syntax:
Comments
<image>
<!—- This is a comment -->
<path value="image.tif" />
<!-- The following section will be ignored -->
<!--
<path value="anotherimage.tif" />
-->
</image>