Topic: xml data extraction from gallery.xml

Hello all,
I'm new to this forum although I've been using Simpleviewer for a few years now. I also started using Tiltviewer recently.

My question applies to both viewers:
Is it possible to extract some data from the gallery.xml file, to use in a different context within the website the gallery is integrated to?

I mean, for example, I have a gallery in a <div>, with captions for each picture, but I want to present the images' captions out of the gallery's <div> when the visitor opens the images. Is it possible in the free version, reserved to the Pro version, or not possible at all?


Thanks in advance.

Last edited by Heywood Floyd (2011-12-11 12:07:51)

Re: xml data extraction from gallery.xml

You can find the caption of the current image being displayed using the SimpleViewer-Pro API: http://simpleviewer.net/simpleviewer/pr … t/api.html
Please note that this will work only with SimpleViewer-Pro (not SimpleViewer-Standard).
You could listen for the svImageChange event to be fired in order to discover when a new image is being displayed and, when it is, use the getImageInfo() method to discover the caption of the image.
Here is sample code (a modified version of the 'javascript_api.html' file found in the SimpleViewer-Pro download package) that will display (in a JavaScript alert box) the caption of the current image as it is being displayed in the gallery:

<script type="text/javascript">

    var svAPI;

    function svComplete() {
        svAPI = document.getElementById('svInstance');        
    }

    function getCurrentCaption(index) {
        var imageInfo = svAPI.getImageInfo(index);
        var currentCaption = imageInfo.caption;
        return currentCaption;
    }
    
    function svImageChange(index){
        alert(getCurrentCaption(index));
    }

    var flashvars = {};
    flashvars.galleryURL = "gallery.xml";
    flashvars.enableAPI = "true";
    
    var params = {};            
    params.allowfullscreen = true;
    params.allowscriptaccess = "always";
    params.bgcolor = "222222";
    
    var attributes = {};
    attributes.id =  "svInstance"; 
    attributes.name = "svInstance";
    
    swfobject.embedSWF("simpleviewer.swf", "flashContent", "800", "700", "9.0.124", false, flashvars, params,attributes);
    
</script>

There is no equivalent API for TiltViewer/TiltViewer-Pro.

Steven Speirs
SimpleViewer Support Team.

Re: xml data extraction from gallery.xml

Thank you very much for your reply, which is very clear, Steven.