Displaying Album image + Image thumbnails on index pg

Hi,

I need help getting a loop to run appropriately inside another loop.. or what the best way to arrange this is.

What I want is:
a. big main album thumb + the first 4 album thumbs small, (these all link you to the first image)
b. then repeat for each following album.

Need help with:

1. The page I've made (richardpierpetit.com/index.php) looks the way I want from using css overrides (except for the error on the bottom), but I'm sure there's a more optimal approach.
a. My attempt to pull the image thumbs inside the main album thumb loop is causing the error, but I don't know what to change to get it to run smoothly.

2. Further, I'd like to only display the first 4 thumbs in the gallery, but the current php code displays all the thumbs due to this line.. "php while next image (false, firstpageimages)" but if I change firstpageimages to a number such as 4, i get the first 4 thumbs for gallery 1, then 2 thumbs for each following gallery.. the array number doesnt reset.

3. I'd like to change the anchor link for all the thumbs to just point to the 1st photo of each album

--Thanks so much for any help!

The code I used is below:

`



`

Comments

  • acrylian Administrator, Developer
    1./2. Set the number of images per page to get on the admin options to 4 and don't set `firstPageCount`
    1a. Don'T know what cause the error. What function do you have at the end of the page?

    3. You have some work to do:
    `
    $images = $_zp_current_album->getImages();
    $firstimage = $images[0];
    $imageobj = newImage($_zp_current_album,$firstimage);
    $firstimageurl = $imageobj->getImageLink();
    `
  • 1./2. I had thumbs set to 4 per page on admin, and then i i took out "false, $firstPageImages" but it still shows them all. ( richardpierpetit.com/index.php )

    1a. fixed: I took out a previous/next navigation print link and it executes the whole script now.

    3. I inserted that above while next image but it didnt seem to do the trick.

    What did I do wrong?
    thank you!

    `
  • acrylian Administrator, Developer
    1. `while (next_image(false, 4)):` should actually work.
    3. `$firstimageurl = $imageobj->getImageLink();` generates the url to the first image of the album in the loop. So you of course need to insert that url to the tag, too....
  • thanks for getting back so quickly-
    I just posted at the website link of what it looks like when I use false, 4. It works for the 1st 4, but after that not so much.. =/

    for the image thumb div links, i tried replacing a href=`echo htmlspecialchars(getImageLinkURL()); ` with getImageLink and that gave an error. Did I put it in the wrong place?
  • I like this idea of using next_image(false, $num) on the index page but I'm experiencing the same issue as chuubenettes.

    I've made the following modifications to index.php at (roughly) line 26:

    `" title="<?php echo gettext('View album:'); ?> <?php echo getAnnotatedAlbumTitle();?>"><?php printAlbumThumbImage(getAnnotatedAlbumTitle()); ?><?php while (next_image(false, 2)): ?><?php printImageThumb(getAnnotatedAlbumTitle()); ?><?php endwhile; ?>`

    This is within the next_album() while loop. The goal here is to have the first two images in any album display along side the main album thumb.

    The issue I'm having occurs when the next_album() loop continues to subsequent albums - the next_image loop, instead of showing the first 2 images, shows all the images of the album beginning with image number 3 and loops to the end of the album.

    Is there some way the next_album() loop can be 'tricked' into thinking that it's always being run for the very first time?

    Thanks,
    -Dave.
  • acrylian Administrator, Developer
    I suggest maybe to work with the class methods. Within the loop the global `$_zp_current_album` is set and you get the images by using `$_zp_current_album->getImages()`. But of course you have some more work to do to get the thumbs. Please see the documentation on the class methods in detail. (assuming you know a little about object orientation). Also please do a forum search, we had this before (I don't remember the thread urls, sorry).
  • Thanks acrylian,

    using your advice and the following post as a guide:

    http://www.zenphoto.org/support/topic.php?id=5486#post-31848

    I was able to come up with this located within the next_album loop:

    `
    <?php
    $images = $_zp_current_album->getImages();
    $firstimage = newImage($_zp_current_album,array_shift($images));
    $thumb = $firstimage->getThumb();
    ?>
    image" />
    `
    A very nice little work around - thanks again for the advice. Now all I need to do is style it! ;p

    -Dave.
  • Works for me too, thanks a lot!
Sign In or Register to comment.