Skip navigation
Currently Being Moderated

Creating a photo gallery like the China Gallery in Adobe Labs. How?

Dec 4, 2009 10:20 AM

I have photos in several categories (I'll use 2, "frank" and "wolfie" as examples here). What I'd like to do is build a photo gallery like the China Photo Gallery shown in the Adobe Labs site, where the user can switch between categories without going to a different page. Here's what I've done so far and how I'm stuck:

 

I created a photo gallery with the instructions in the tutorial "Building a photo album with the Spry Framwork". I then inserted a Tabbed Panels widget for navigating between the categories.

I set up an XML file as follows:

 

/* frank category */

<photo
path = "001p.png"
width = "467"
height = "467"
thumbpath = "001p.png"
thumbwidth = "85"
thumbheight = "85">
</photo>

 

/* wolfie category */

<photo
path = "001f.png"
width = "467"
height = "467"
thumbpath = "001f.png"
thumbwidth = "85"
thumbheight = "85">
</photo>

 

To create the div holding the thumbnails for the "frank" category, I entered the following:

 

<div class="thumbdiv" spry:region="dsGallery"><img src="thumbnails/frank/{@thumbpath}" spry:repeat="dsGallery" spry:setrow="dsGallery" class="thumbs" /></div>

 

To create the div where the full size images will be displayed, I entered the following:

 

<div class="mainpic" spry:detailregion="dsGallery"><img src="images/frank/{@path}" onload="MM_effectAppearFade(this, 1500, 0, 100, false)" /></div>

Then, in the tabbed panel set for the "wolfie" category, I did the same thing, substituting "wolfie" for "frank". However, since there is only one xml file, spaceholders for all of the thumbnails appear in the thumbnail div for the frank category. I realize that I'll probably need to create a separate xml file for each category, but how do I set it up so the correct xml file is accessed when the link in the tab is clicked? Or am I approaching this all wrong?

 

From reviewing the source for the China gallery, it appears that they set up links to different xml files instead of Tabbed Panels. How does that work? There are also some javascript files I can't find anywhere on Adobe's site.

 

Thanks

 
Replies
  • Currently Being Moderated
    Dec 7, 2009 3:24 PM   in reply to Bruce BFD

    Hi,

     

    If you have seperate XML file but with the same basic structure then you can change the XML a Spry dataset refers to and regenerate the spry region without reloading the full page.

     

    So on my photo gallery page I can change the album the photos are shown from via the seturl sprydata function as below.  dsPhotos being my Spry dataset that points to the relevant XML dataset with my image references and captions etc.  My XML is actually dynamically generated from Picasa RSS feeds (and RSS feeds are XML) but the principle will be the same with your static XML.

     

    First I add an event listener for when someone clicks on an album (the li tag within my div with the id "albums" holds a photo and title for each album.)

     

    function Albums()
    {
    var myalbums = Spry.$$("#albums li", "TabbedPanels1")
    var rows = dsAlbums.getData();
    var setListener = function( element, value )
    {
      Spry.Utils.addEventListener( element, "click", function(){ showAlbum( value ); },false );
      };
    for( var i = 0, length = myalbums.length; i < length; i++ )
    {
      setListener( myalbums[i], i );
      }

    }

     

    Then this is the code which changes the photo album to be shown. (when the user clicks the relevant album)

     

    function showAlbum(i)
    {
    pauseShow();
    pImage = 'No';
    var rows = dsAlbums.getData();
    var albumid = rows[i]["albumid"];
    var url = "xml/PicasaAphotoFeed.asp?albumid=" + albumid;
    dsPhotos.setURL(url);
    dsPhotos.loadData();

     

    var rowcount = dsAlbums.getRowCount() - 1;
    var nextalbum;
    var navnext;
    var n;

    ...

    }

     

    The page is here www.thehmc.co.uk/photo5.html is you want to see it in context.

     

    In your case showAlbum would switch between Frank.xml or Wolfie.xml depending on how you decide to name your xml datasets.

     

    Regards

     

    Phil

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 10, 2009 4:27 AM   in reply to Bruce BFD
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points