Viewer setup with rootPath


New member
I'm a PRO customer and we want to keep all our images on our cdn. Looks like the rootPath setting is what we need.

Is there a guide or sample that shows how rootPath is configured?


Active member
Hi Brian, here's what we have for rootPath in our user guide:

This optional setting can be used to specify alternative location of viewer assets (images, hot-spot rollover images, etc) that are configured in xml and passed via configFileURL. When this settings is specified, the viewer will first load the xml configuration specified in configFileURL and will then append the rootPath to any path specified in the xml file. This is valuable when you need to store image assets on dedicated file servers or CDN locations.

Here's how this would apply to the CDN scenrio:

Server 1:
- product pages.
- imagerotator scripts / css.
- viewer config xml for each product as generated by SpotEditor (with a relative path for all referenced images).

Server 2:
- folders with images / hot-spots for each product.

So you would have something like this on your product page on server 1:

_imageRotator.settings.configFileURL = "/360-xmls/product1_config.xml";
_imageRotator.settings.rootPath = "http://server2/360-assets/product1"; // product1 is a folder with images.

During loading, the relative path of each image in the xml is appended to the rootPath, ie http://server2/360-assets/product1

Note: if you don't use various hot-spots from product to product, you can use just one xml for all your products and just switch image folders on the current or external server via the rootPath parameter.