I have the Hidden Items module installed and noticed that the image count shown for albums that either are themselves hidden or contain hidden items, the image count shown is incorrect.
And just to let you know, this is not limited to only excluding items that are hidden and the user has not unhidden yet. Even after the user has unhidden a particular image, it doesn't seem to show up on the image count for the album!
Any ideas?
Regards,
KH
Posts: 16504
What's incorrect? Is something not getting counted or is something getting counted more than once?
Have you tried clearing Gallery's cache?
FAQ: How can I clear cached data?
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 44
Hello Nivekiam,
The image count is incorrect. Items within a Hidden album are not getting counted even when the hidden album gets diplayed.
For example:
I have a hidden album in my gallery called personal. Inside this album, I have another hidden album titled snow.
Once you have unhidden both albums, you will notice that when you navigate to personal the image count for the child album snow is not displayed at all!
Also, I have already cleared the cache using gallery/lib/support multiple times. It doesn't seem to help here.
I hope this articulates the problem sufficiently. Please let me know if you need more information.
Regards,
KH
Posts: 44
Figured this one out partially.
Looks like this is a problem with the Siriux theme. Siriux makes use of the following code snippet in its album.tpl:
I looked at the matrix theme to check how it handles this and then changed the above code snippet as below:
It now at least shows some numbers. However, I still find that both in Siriux and Matrix themes the $child.descendentCount is always 0 for hidden albums. So for such hidden albums it always shows only the items that are contained immediately inside the album excluding items in sub-albums.
Any ideas why the descendentCount variable is always set to 0 for hidden albums?
Regards,
KH
Posts: 16504
I'd have to ask the devs to be sure, but I'm guessing that it's probably because it's hidden That ended up being more of a smartarse remark than I intended...
Hidden items behave differently. They are not visible until they are visited. Does the count still remain 0 after you've visited the hidden album/item?
http://codex.gallery2.org/Gallery2:Modules:hidden
You can't link directly to an item inside a hidden album, the user will get an error, you have to point them to the album first, then direct them to what you want them to see.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 44
The count stays 0 even after you have viewed the complete album.
In the example I provided earlier, there is a hidden album personal with another hidden album snow inside it.
The album personal has only one sub-album inside it and no other photos.
The sub-album snow is itself hidden and has 14 images inside it.
Hence, to begin with, the item count for the album personal can be expected to show 0.
However, once I have navigated to the sub-album snow, I would expect the descendant count for the parent album to show 14.
Well, it doesn't. The image count against personal when viewed from the root gallery still shows 1 item.
Posts: 16504
I think your browser is caching stuff.
Once I viewed snow, then went to personal, I see Snow with 14 items. Then if I go to "mypictures" I see personal with 1 item.
Looks like it's working correctly to me. That's not "image" count for personal, that's how many items are in personal. Which is 1, then that 1 item has 14.
Going over this reminds of a thread from long ago. Basically, Gallery does not recursively go through all sub-albums to count the items. Doing so would create a big performance hit.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 44
I disagree. Gallery seems to avoiding recursive counting for only the hidden albums.
For example, in mypictures if you check the item count for the albums "London" or "Trip to Italy & Spain", you will see the item count as "29 items total" and "205 items total" respectively.
Here, Gallery counts the items recursively. The album "London" has 4 images and one sub-album which in-turn contains 24 items (a total of 24 + 5 = 29 items total). Similarly the album "Trip to Italy & Spain" contains 4 sub-albums containing 97, 11, 37 and 56 items (97 + 11 + 37 + 56 + 4 = 205 items total).
The recursive counting doesn't work for hidden albums only.
Regards,
KH
Posts: 16504
Switch to the Matrix theme and see how it behaves. On one of my installs I have an album:
Christmas (shows only 2 items)
\Saturday (80+items)
\Sunday (60+items)
I'm using the Matrix theme.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 44
It works just as I described above in the Matrix theme as well. For the non-hidden albums, the total number of descendants are shown. Notice the counts shown against the albums "London" and "Trip to Italy & Spain".
However, for the hidden albums of Personal and Snow, the count when seen in the root album only shows the child count and not the descendant count. I looked at the code and believe this is due to the variable descendantCount being set to zero.
Regards,
KH
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here
Posts: 16504
If you want to fix this, you're going to have to dig around in the hidden items plugin. That's where it's "broken". That plugin does cause some odd behavior and this is apparently one side effect of it.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here