We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30328
    • 35 Posts
    Hi,

    I’m trying to set up a system where I have a MonoSlideshow (Flash / SWF) gallery on the front end, and essentially a backend by MaxiGallery, where users can upload and sort photos (in various galleries). The problem is that MonoSlideshow needs an XML configuration file to tell it the location of the photos, and descriptions etc.

    The data that the XML file needs is (at least, this is all that I require... MonoSlideshow can show photo title and description but I don’t need that):

    For every gallery:
    - Gallery name
    - Gallery Description
    - Directory where large photos are located
    - Directory where thumbnails are located (where each thumbail has the same file name as it’s large version, see below)
    - Photo file names

    How can such an XML file / feed be created?

    Also, there is the issue of thumbnails: at the moment MaxiGallery creates them in the same directory as the large photos, but with a prefix of "tn_". Is there a way to set them to be created in a sub directory of the gallery directory, say "thumbnails" and with no prefix?

    I hope someone can help,

    Tommy T.
      • 24530
      • 100 Posts
      why use flash combined with js if js alone can do the same?
      ... but if you want to use MonoSlideshow, I would not combine it with MaxiGalery ... I would prefer to use pages with TV´s for the pictures (content = description, TV = picture) and use Ditto to generate the XML. with a nested structure you can organize the galeries ...

      just my 2 cent ...
        my newest webpage [url=http://gitarren.zucali.at]Meisterwerkstatt f
        • 7923
        • 4,213 Posts
        Quote from: tommyt at Jun 20, 2007, 03:58 AM

        Hi,

        I’m trying to set up a system where I have a MonoSlideshow (Flash / SWF) gallery on the front end, and essentially a backend by MaxiGallery, where users can upload and sort photos (in various galleries). The problem is that MonoSlideshow needs an XML configuration file to tell it the location of the photos, and descriptions etc.

        The data that the XML file needs is (at least, this is all that I require... MonoSlideshow can show photo title and description but I don’t need that):

        For every gallery:
        - Gallery name
        - Gallery Description
        - Directory where large photos are located
        - Directory where thumbnails are located (where each thumbail has the same file name as it’s large version, see below)
        - Photo file names

        How can such an XML file / feed be created?
        Without knowing the actual structure of the XML, you could either use maxigallery custom templates or create another snippet that queries maxigallery db table to find the information.

        Quote from: tommyt at Jun 20, 2007, 03:58 AM

        Also, there is the issue of thumbnails: at the moment MaxiGallery creates them in the same directory as the large photos, but with a prefix of "tn_". Is there a way to set them to be created in a sub directory of the gallery directory, say "thumbnails" and with no prefix?
        It’s possible to do, but you will need to modify the areas in maxigallery code where thumbnails are created and paths built to them. You would need to read though the code.

        Quote from: raum at Jun 20, 2007, 04:47 AM

        I would prefer to use pages with TV´s for the pictures (content = description, TV = picture) and use Ditto to generate the XML. with a nested structure you can organize the galeries ...
        I would also suggest to do this instead.


          "He can have a lollipop any time he wants to. That's what it means to be a programmer."
          • 30328
          • 35 Posts
          Quote from: doze at Jun 20, 2007, 06:24 AM

          Without knowing the actual structure of the XML, you could either use maxigallery custom templates or create another snippet that queries maxigallery db table to find the information.
          Ah... I didn’t think of the custom templates: thanks.
          Quote from: doze at Jun 20, 2007, 06:24 AM

          It’s possible to do, but you will need to modify the areas in maxigallery code where thumbnails are created and paths built to them. You would need to read though the code.
          I will look into this, thanks.
          Quote from: doze at Jun 20, 2007, 06:24 AM

          Quote from: raum at Jun 20, 2007, 04:47 AM

          I would prefer to use pages with TV´s for the pictures (content = description, TV = picture) and use Ditto to generate the XML. with a nested structure you can organize the galeries ...
          I would also suggest to do this instead.
          Ah raum pointed out, very similar effects can be acheived with js libraries. I may decide to use these later, which is one of the reasons why I would like to have this set up with MaxiGallery: so I could easily change to js if I want to. I’ll think about this, but I think I will stick with MaxiGallery for the time being.

          Thanks for your help,

          Tommy T.
            • 30328
            • 35 Posts
            There is one thing about making the XML page via MaxiGallery templates that I’m not sure about. I would like to have one XML file with all the information about all the galleries, divided up into galleries. It’s something like this for the case of two galleries:
            <gallery title="galleryTitle" description="the description" path="pathToGallery">
              <photo src="pathToImageRelativeToGallery">
            </gallery>
            <gallery title="galleryTitle2" description="the description2" path="pathToGallery2">
              <photo src="pathToImageRelativeToGallery2">
            </gallery>
            

            I think I can get all photos into an XML page using &gal_query_ids, but they wouldn’t be separated into their separate galleries. Is it possible to have all the photos from all the galleries on one page, but somehow separated into separate galleries?

            Tommy T.

              • 30328
              • 35 Posts
              Hi,

              I created my own (first) snippet to query the database directly. Just in case anyone is ever interested, the code is below. (It doesn’t take any parameters, they are hard coded in at the top for the time being). (And I realised that I didn’t have to change the naming of thumbnails, they can individually be specified for each photo.

              // Parameters
              $parentId = 54;
              $pathToGalleries="assets/galleries/";
              $gTbl = "maxigallery";
              $orderBy = "pos";
              
              // Id of (possible) Child Galleries, in reverse order of creation
              $galleryIds = array_reverse($modx->getChildIds($parentId, 1));
              
              // Select MaxiGallery Table
              $picsTbl = $modx->db->config['dbase'].".".$modx->db->config['table_prefix'].$gTbl;
              $fields = "*";
              $from = $picsTbl;
              
              // Create XML Document
              $xmlDoc = '<?xml version="1.0" encoding="utf-8"?>';
              $xmlDoc .= '<slideshow>';
              $xmlDoc .='	<preferences
              		
              		autoPlay = "false"
              
              	/>';
              
              
              // Loop over all (potential) galleries
              foreach ($galleryIds as $galleryId) {
                // Get pics in gallery from database
                $where = "gal_id=".$galleryId;
                $res = $modx->db->select($fields,$from,$where,$orderBy);
              
                $numPicsInGallery = $modx->db->getRecordCount($res);
                if ($numPicsInGallery > 0) {
              
                  // Get gallery page info
                  $galleryInfo = $modx->getPageInfo($galleryId,0, "id, pagetitle, longtitle, description, alias, createdby");
              
                  // Get Gallery Info
                  $pathToGallery = $pathToGalleries.$galleryInfo['id']."/";
                  $galleryTitle = $galleryInfo['pagetitle'];
                  $galleryDescription = $galleryInfo['description'];
              
                  // Get first picture for album thumb
                  $pic = $modx->fetchRow($res);
                  $picFileName = $pic['filename'];
              
                  // Add album info to feed
                  $xmlDoc .= '<album imagePath="'.$pathToGallery.'" thumbnailPath="'.$pathToGallery.'" thumbnail="'.$pathToGallery.$picFileName.'" description="'.$galleryDescription.' " title="'.$galleryTitle.'" >';
              
                  // Add picture to feed
                  $xmlDoc .= '<img src="'.$picFileName.'" thumbnail="tn_'.$picFileName.'"/>';
              
                  // Loop over rest of pictures in gallery
                  while ($pic = $modx->fetchRow($res)) {
                    $picFileName = $pic['filename'];
                    $xmlDoc .= '<img src="'.$picFileName.'" thumbnail="tn_'.$picFileName.'"/>';
                  }
              
                  $xmlDoc .= '</album>';
                }
              }
              
              $xmlDoc .= '</slideshow>';
              echo $xmlDoc;
              


              Tommy T