How to add parameters
Parameters are added to the <fsi-viewer>
tag. Note that you can as well use FSI Viewer configuration files (required e.g. when using hot spots):
Adding Parameters to the viewer
<head>
//adding the fsiviewer.js script
<script src="js/fsiviewer.js" type="text/javascript"></script>
</head>
<body>
//adding parameters directly to the tag:
<fsi-viewer width="500" height="600" src="/images/sample.jpg" debug="true" skin="silver"></fsi-viewer>
//example with using a FSI Viewer configuration file:
<fsi-viewer width="500" height="600" src="/images/sample.jpg" cfg="sample/sample_configuration"></fsi-viewer>
</body>
Simple Configuration File
You can also define individual configuration .xml
files like this:
<fsi_parameter>
<image>
<path value="samples/Watch.jpg" />
</image>
<Viewer>
<skin value="silver" />
<debug value="1" />
<noNav value="true" />
</Viewer>
</fsi_parameter>
Defining Global Parameters
If you would like to use global parameters for all FSI Viewer instances,
the corresponding parameters can be defined in the _default.xml
.
<fsi_parameter>
<Image>
<ServerType value="FSI"/>
</Image>
<Viewer>
<skin value="white" />
<inPlaceZoom value="true" />
<hideUI value="false"/>
<adaptiveuisize value="true"/>
</Viewer>
<Options>
<FSIBase value="config/"/>
<Language value="english"/>
<ScenePreload value="true"/>
</Options>
</fsi_parameter>
Passing Parameters to the script
You can optionally modify the way FSI Viewer works by passing parameters to the script. To do so, pass an object containing the parameters and value as an object to the constructor:
var node = document.createElement("fsi-viewer");
node.style.width = "600px";
node.style.height = "400px";
var parameters = {"imagesrc" : "images/Rocker Shoe.tif", "skin":"silver", "debug":true};
$FSI.setParameters(node, parameters);
document.body.appendChild(node);
// Important: call this AFTER adding the node to the DOM
$FSI.initCustomNode(node);
$FSI.initCustomNode(node)
initializes the given node.
When adding multiple viewers you can initialize all new FSI Viewer nodes in one go, using this command:
$FSI.initCustomTag("fsi-viewer");
or, when using different custom tags (<fsi-viewer>
, <fsi-imageflow>
,…):
$FSI.initCustomTags();
to initialize all new FSI custom tags.