self and sibling subalbum thumb listing

Within a subalbum, in album and image contexts, I'd like to be able show the thumbnails of all sibling albums.

For example, in album "Portfolio", there are subalbums "Spread1","Spread2","Spread3".
While looking at the thumbs or an image within "Spread2", I'd like to have a separate navigation that will show all the thumbs within all of the subalbums within "Portfolio"

Something like this seems similar to the PrintAlbumMenu function, where subalbums can be listed independent of gallery context. I've played with that code but cant seem to get an image loop to work within each level one subalbum.

In a parent album with subalbums, this works to show all subalbum thumbs:
`

<?php while (next_album()): ?>

<?php while (next_image()): ?>

" title="<?php echo getImageTitle();?>"> <?php printImageThumb(getImageTitle()); ?>

<?php endwhile; ?>

<?php endwhile; ?>

`

So i've also tried creating a custom function basically combining getparentalbums() and next_album(), for use within a subalbum, but havent had any luck.

I'm basically pulling my hair out here, my php is pretty weak.

Any suggestions?

Comments

  • if you put this in your album.php it shows all the thumbnails contained in the parent album of the current album.

    maybe some use..
    `

      <?php <br />
      $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray);
      $images = getImageStatistic($photosNumber, "latest");
      $parent = $_zp_current_album->getParent();
      if (!is_null($parent)) { $parent = $parent->name; } else { $parent = getGalleryIndexURL(); }
      foreach ($images as $image) {
      $imageURL = getURL($image);
      $check = substr_count($imageURL,$parent);
      if ($check == 1) {
      echo 'getTitle() . '">getCustomImage(null, 30, 30, null, null, null, null) . '" width="30" height="30" style="margin-right:9px;margin-top:16px;margin-bottom:20px;padding:0px;border:1px solid #d2d2d2;" alt="' . $image->getTitle() . ""/>";
      }
      }?>
    `
  • hmm code pasting still messes up things...
  • i just changed the

    `echo ''` to `echo '`
    and towards the end...
    `""/>";` to `'"/>";`

    and it works!!! thanks so much, i really appreciate the reply.
  • yes noticed that also. already updated the '' after the echo but couldn't edit anymore the end so here for anyone else that's interested the proper code

    glad I could help

    `

      <?php<br />
      $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray);
      $images = getImageStatistic($photosNumber, "latest");
      $parent = $_zp_current_album->getParent();
      if (!is_null($parent)) { $parent = $parent->name; } else { $parent = getGalleryIndexURL(); }
      foreach ($images as $image) {
      $imageURL = getURL($image);
      $check = substr_count($imageURL,$parent);
      if ($check == 1) {
      echo 'getTitle() . '">getCustomImage(null, 30, 30, null, null, null, null) . '" width="30" height="30" style="margin-right:9px;margin-top:16px;margin-bottom:20px;padding:0px;border:1px solid #d2d2d2;" alt="' . $image->getTitle() . '"/>';
      }
      }?>
    `
  • i was using the code above but needed a bit more flexibility, and the page was loading pretty slowly. so i figured out another way to print all subalbum images within a particular album

    `

    function getsiblingimages() {

    global $_zp_current_album;

    $parentalbum = $_zp_current_album->getParent();

    $siblingalbums = $parentalbum->getSubalbums();

    foreach ($siblingalbums as $siblingalbum) {

    $sibalbumobject = new Album($parentalbum->gallery, $siblingalbum);

    $sibimagefilenames = $sibalbumobject->getimages();

    foreach ($sibimagefilenames as $sibfilename) {

    $sibimageobject = new Image($sibalbumobject, $sibfilename);

    $sibimage = $sibimageobject->getCustomImage(null, null, 50, null, null, null, null);

    echo 'image';

    }

    }

    }

    echo getsiblingimages();

    `

    i am by no means a PHP expert, but the code works for my purposes and give me better layout flexibilty, and loads a bit faster than the one above...maybe this is useful for someone

    how did i use it and why? i have an album "portfolio". this album contains about 30 subalbums with no more than 3 images within them. my photographer client wants to display his photos as spreads, so, when looking at a subalbum, 1-3 images show up pretty large. also on this subalbum page is the code above (with links and more containers added). this code serves as a horizontal navigation bar, where every subalbum of "portfolio" is represented by all of its images as a mini-spread. nice.

    also, i just wanted to give a huge huge thanks to the developers for giving subalbums the attention they deserve in the new version...among everything else....keep on truckin, zenphoto has been incredibly useful for me and really user friendly for my clients...
  • that's much more elegant indeed.

    only thing I noticed is that it doesn't get the thumbs for the subalbums of a sibling on the same level that doesn't have thumbs but only other subalbums.
  • that would make sense, i made it for a pretty specific album structure. to fix that i guess you would set up some conditionals and a loop that would keep running the script until all subalbums of subalbums have been exhausted...i dont really have time to flesh that out but youre welcome to take a crack at it...
Sign In or Register to comment.