1

(15 replies, posted in Juicebox-Lite Support)

Hi Terry,
I was checking whether it is possible to display albums from slideshowpro director in Juicebox. Basically, it is only necessary to translate the xml generated by slideshowpro director in the format used by Juicebox.
I wrote a quick php script that does this which you can find below.

<?php 
$baseURL = $_GET['baseURL'];
$parameters = array(
    'album' => $_GET['album'],
    'w' => $_GET['w'],
    'h' => $_GET['h'],
    's' => $_GET['s'],
    'q' => $_GET['q'],
    'sh' => $_GET['sh'],
    'tw' => $_GET['tw'],
    'th' => $_GET['th'],
    'ts' => $_GET['ts'],
    'tlw' => $_GET['tlw'],
    'tlh' => $_GET['tlh'],
    'tq' => $_GET['tq'],
    'tsh' => $_GET['tsh'],
    'pw' => $_GET['pw'],
    'ph' => $_GET['ph'],
    'aps' => $_GET['aps'] );


header('Content-type: application/xml');
$doc = new DOMDocument('1.0', 'iso-8859-1');
$sourceURL = $baseURL . "/images.php?" . http_build_query($parameters);
$doc->load( $sourceURL ); 

$images = array();

$xmlimages = $doc->getElementsByTagName( "img" );
foreach( $xmlimages as $xmlimage ) 
{ 
$images[] = array( 'id' => $xmlimage->getAttribute('id'),
                   'src' => $xmlimage->getAttribute('src'),
                   'file' => $xmlimage->getAttribute('file'),
                   'tn' => $xmlimage->getAttribute('tn'),
                   'tnsm' => $xmlimage->getAttribute('tnsm'),
                   'dims' => $xmlimage->getAttribute('dims'),
                   'fp' => $xmlimage->getAttribute('fp'),
                   'target' => $xmlimage->getAttribute('target'), 
                   'tags' => $xmlimage->getAttribute('tags'));
} 

$dom = new DOMDocument('1.0', 'UTF-8');
$dom->formatOutput = true;
 
$r = $dom->createElement( "juiceboxgallery" );
$dom->appendChild( $r );
 
foreach( $images as $image )
{
 $b = $dom->createElement( "image" );
 
 $title = $dom->createElement( "title" );
 $title->appendChild(  $dom->createTextNode( $image['tag'] ) );
 $b->appendChild( $title );

 $b->setAttribute( "imageURL", $baseURL . "/p.php?a=" . $image['src'] );
 $b->setAttribute( "thumbURL", $baseURL . "/p.php?a=" . $image['tn']  );
 $b->setAttribute( "linkURL", $baseURL . "/p.php?a=" . $image['src'] );
 $b->setAttribute( "linkTarget", $image['target'] );

 
 $r->appendChild( $b );
 }
 
 echo $dom->saveXML();
 $dom->save("config.xml")
?> 

put this script as config.php (needs php5) into the same folder as your Juicebox html file.
In the html file change the configURL add the URL encoded URL of your ssp_director installation in the last option

        <script src="jbcore/juicebox.js"></script>
        <script>
            new juicebox({
                containerId : 'juicebox-container',
                configUrl : 'config.php?album=7&w=800&h=600&s=0&q=80&sh=1&tw=100&th=100&ts=0&tlw=50&tlh=50&tq=60&tsh=1&pw=54&ph=40&aps=0&baseURL=http%3A%2F%2Fdomain.name%2Fssp_director' 
            });

        </script>

The parameters determine the album number and the sizes of images and thumbnails. The script still needs some polishing, but worked for me. I will add more in case I find time ;)

UrsusMaritimus