Subalbum changes thumbs number on first page

I have this strange problem that occurs as soon as I create a sub-album in an album with several pages. The main album has 78 images, 20 thumbs per page; the sub-album has 20 images.

The index and album pages have $firstPageImages = normalizeColumns('5', '4'); at the top of the page. The theme options is set to 20 albums/page and 20 images/page.

Without the sub-album, I get as expected, 4 pages, each with 20 thumbs per page. If I add the sub-album, I have only 17 thumbs on the first page (including the sub-album thumb), 2o thumbs on pages 2,3 and 4, and 2 thumbs are pushed on page 5. Obviously, this is not what is to be expected.

Hovering the cursor over my main album I get the information: 78 photos (16+3x20+2).
As soon as I unpublish the sub-album, the main album shows the correct number of thumbs on each page (20 on the first 3 pages, 18 on page 4).

Any thoughts on what might be causing this odd behavior?

If this a known bug, I did not find it reported. Removing the normalizeColumns from the index and album pages does not make any difference, nor does removing the quotes on its parameters.

Comments

  • acrylian Administrator, Developer
    That is actually meant to equalize the display of subalbum/image mixed albums. Have you read this?http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionnormalizeColumns
  • marcov Member
    Yes, I had actually read it:

    "The return value should be passed as the second parameter to next_image() so that the page is filled out with the proper number of images."

    If I interpreted correctly the guide, using the following code I should not have had the problem, the page should display the correct number of thumbs, 20, including the sub-album thumbs.

    <!-- Images -->
    <?php while (next_image(false, $firstPageImages)): ?>

    So even though (I think) I have the call as per the guide, the result is not what is expected.
  • The function is behaving as expected. In your case with the album thumb you have one album row and 4 image rows for a total of 16 thumbs.
  • marcov Member
    My expected behavior was to have each page filled with thumbs, including the first one, with 20 thumbs per page. In other words, put out all album thumbs, then the image thumbs until the total of thumbs per page is 20(or whatever I set it to in the theme options), then move on to the next page. Is this feasible with the current version?

    Also, to be precise, in my case it is not one album row and 4 image rows (the setup is 4 rows 5 colums) and what I get is this: the first row consists of 1 sub-album thumb + 4 image thumbs, then I have 3 rows of 5 image thumbs each, and the last row, instead of showing 5 image thumbs it shows only 2, leaving a gap of missing 3 thumbs.

    In the meantime, until I find a solution, I just moved out the sub-album and made it into a main album and right away, the main album nicely fills each page with 20 thumbs. Could this currently work the same way even if I have sub albums? A thumb is a thumb, so when I set the theme options to 20 thumbs per page, I would like to have 20 thumbs per page, regardless of what kind they are, representing sub-albums or images.
  • acrylian Administrator, Developer
    These settings is also dependend on your theme's css. As you may have noticed in the standard themes albums have also a title and description shown and are not the same as image thumbs. If you haven't please read:
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionnormalizeColumns
  • And, to boot, you seem to have said that your album thumbs are different from your image thumbs, otherwise there would be the same number of each in a row.
  • marcov Member
    My theme CSS works as expected, it fills each row with the number of thumbs that fit on it then moves down and fills the following rows until it completes the page. So it is not a CSS problem at all.

    I read and re-read the functions guide.

    If I call normalizeColumns(5,5) and loop over the albums first, I get 3 rows of 5 thumbs each, the first row has the one sub-album thumb, followed by 4 image thumbs, which is ok, but the last row has only one image thumb, instead of 5. I would expected the image loop to continue to fill the last row with thumbs, not stop after 1 thumb.

    If I call normalizeColumns(5,5) and loop over the images first, I get the same result as above, except the last row has only the sub-album thumb, whereas I would have expected that the image loop spits out pages full with image thumbs, until there are no more images, at wich point the album loop kicks in and spits out the album thumbs until it fills a page or is done with the albums.

    In fact, no matter what values I call the normalizeColumns with, or how I set the theme options, it is impossible to get a full page of thumbs if there is a sub-album.
  • marcov Member
    OK. Let's take an other angle on it. From a user perspective, would it not make more sense to have pages filled with thumbs, eve if some of them are album thumbs? This would give the aesthetically pleasing complete pages, rather than the incomplete last row on a page?

    Also, the theme option specifies say, 20 albums/page and 20 images/page, but if there are fewer than 20 albums, then just print as many as they are, then continue with the image thumbs until a page has 20 thumbs, then move on to the next page.

    Instead, now we have this behavior: print out the album thumbs, continue with the image thumbs, then for some odd reason, leave a gap of x thumbs, on the last row, instead of filling it with thumbs, and move on the next page. Is this not bizarre? I mean, I can not see the logic why would one want to leave the last row less than full when there are in fact thumbs to fill the row?
  • I guess you haven't noticed that this function works as intended with all the Zenphoto themes. So, probably since you want something different you should not be using it.
  • marcov Member
    "And, to boot, you seem to have said that your album thumbs are different from your image thumbs, otherwise there would be the same number of each in a row."

    No, actually my album and image thumbs are identical. Sorry, that (5, 4) was a typo on the initial post.
  • acrylian Administrator, Developer
    How do visitors see the difference then? Anyway, we speak of course for the standard themes (except stopdesign maybe). We dont know your custom one. Maybe you should post a link.
  • marcov Member
    Yes, I did notice that the odd behavior is consistent for all albums, it still does not make the pages look right when the last row is missing thumbs.

    In fact, I think the normalizeColums function only complicates things. We don't need to specify the number of columns, only the number of thumbs per page. The number of columns will be controlled anyway by CSS (i.e. by how many thumbs fit in the given page width)

    Also probably having the option of different number of album and image thumbs on a page is a complication, unless one really wants a different number of albums and image thumbs on a page.

    Here's the logic that I think would print pages filled with thumbs, regardless whether they are album or image thumbs or a mix of both.

    currentAlbumNumber = 0
    currentImageNumber = 0
    currentThumbNumber = 0
    currentPageNumber = 1

    // Albums loop
    while currentAlbumNumber < numberOfAlbums
    ...print an album thumb
    ...increment currentAlbumNumber
    ...increment currentThumbNumber
    ...if mod(currentThumbNumber,thumbsPerPage) - currentPageNumber = 0
    ......print a page break
    ......increment currentPageNumber

    // Images loop
    while currentImageNumber < numberOfImages
    ...print an image thumb
    ...increment currentImageNumber
    ...increment currentThumbNumber
    ...if mod(currentThumbNumber,thumbsPerPage) - currentPageNumber = 0
    ......print a page break
    ......increment currentPageNumber

    The above logic would work for both index.php and album.php.

    Is there a way to implement this logic in index.php and album.php without having to change the zenphoto code?
  • Of course there is. Please review the themeing guide and the zenphoto functions guide. If you need a capability not there you will have to code it yourself.
Sign In or Register to comment.