Web Analytics Made Easy -
StatCounter ssp director php to output xml - CodingForum

Announcement

Collapse
No announcement yet.

ssp director php to output xml

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ssp director php to output xml

    Hi all,
    Could anybody help me in changing the php file below
    I am trying to connect slideshowpro.net director over its api with my flash gallery which calls for the following xml data

    <?xml version="1.0" encoding="UTF-8"?>
    <images>
    <category title="Audi" thumb="_img/cat_01.jpg">
    <img>
    <title>Audi A4 Cabriolet</title>
    <bimage>imag/02.jpg</bimage>
    <thumb>imag/tb_02.jpg</thumb>
    <desc>Audi A4 Cabriloet.</desc>
    </img>

    There is a sample code in the ssp forum for a 3D wall with a diverent xml structure. Should be a good indication of what is needed

    PHP Code:
    <?php
    include('classes/DirectorPHP.php');
    $director = new Director('your-api-key''your-api-path');

    $director->format->add(array('name' => 'thumb''width' => '150''height' => '100''crop' => 1'quality' => 75'sharpening' => 1));
    $director->format->add(array('name' => 'large''width' => '400''height' => '300''crop' => 1'quality' => 95'sharpening' => 1));

    $recent $director->content->all(array('limit' => 10'only_images' => true));

    $pathToThumb "images/thumb/";
    $pathToLarge "images/large/";
    $count 1;

    foreach (
    $recent as $image) {
        
    $thumbURL $image->thumb->url;
        
    $thumbFile imagecreatefromjpeg"{$thumbURL});
        
    $thumbTemp imagecreatetruecolor150100);
        
    imagecopyresized$thumbTemp$thumbFile0000150100150100);
        
    $thumbName "thumb_" $count ".jpg";
        
    imagejpeg($thumbTemp,"{$pathToThumb}{$thumbName}");
       
        
    $largeURL $image->large->url;
        
    $largeFile imagecreatefromjpeg"{$largeURL});
        
    $largeTemp imagecreatetruecolor400300);
        
    imagecopyresized$largeTemp$largeFile0000400300400300);
        
    $largeName "large_" $count ".jpg";
        
    imagejpeg($largeFile,"{$pathToLarge}{$largeName}");
        
    $count++;
    }

    $xml_output "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
    $xml_output .= "<photosplash>\n";

    $i=1;

    while(
    $i<=10) {
        
    $xml_output .= "\t<image>\n";
        
    $xml_output .= "\t\t<title>Title goes here.</title>\n";
        
    $xml_output .= "\t\t<description>Description goes here.</description>\n";
        
    $xml_output .= "\t\t<small>images/thumb/thumb_" $i ".jpg</small>\n";
        
    $xml_output .= "\t\t<large>images/large/large_" $i ".jpg</large>\n";
        
    $xml_output .= "\t\t<largeWidth>400</largeWidth>\n";
        
    $xml_output .= "\t\t<largeHeight>300</largeHeight>\n";
        
    $xml_output .= "\t</image>\n";
        
    $i++;
    }

    $xml_output .= "</photosplash>";

    echo 
    $xml_output;
    ?>
    You can find the slideshowpro wiki here http://wiki.slideshowpro.net/SSPdir/API-API

    Thank you for your

    Regards Rain
Working...
X