Hello all,
In albums.php (the top level Gallery page), in the admin section, Gallery displays "X albums, X photos" ($numAlbums, $numPhotos (= $albumDB->getCachedNumPhotos)). But Gallery counts each nested album (even if it's empty) as if it were a photo. This is misleading: e.g. I have an album with several nested albums which are empty (waiting to be populated), but album.php would have you believe that it contains several photos. Is there any way to get $numPhotos to be more specific/accurate, and represent only the number of actual photos?
I've tracked it down to the function getCachedNumPhotos in AlbumDB.php, but here is where my php skills (i.e. lack thereof) stops. Any idea how I might do this? (maybe by subtracting the number of nested albums? Is this value determinable?)
Thanks a million to anyone who can help, LEN
For the record, I am using Gallery to organize images into categories (albums) and subcategories (nested albums), so I don't mind when view_album.php indicates "X items (i.e. subcategories) in this album (i.e. cagtegory)", since this is independent of the number of photos in the nested albums. (note: this methodology means there are no 'loose' photos that are not in a nested album).
Posts: 3474
No use re-inventing the wheel:
http://gallery.sf.net/forums.php?topic=2317
-Beckett (
)
Posts: 18
I searched a LOT before posting... thanks for the lead... I wish people's posts would be more search-friendly (use likely kewords to help future searchers)
Thanks again. LEN
Posts: 18
This was the relevent part of the albums.php code after the patch:
This helped, but still did not display the number of actual photos independently of the number of sub-(nested) albums. What it now displayed was: 5 top-level albums (46 total), & 44 photos. In my test example, I had 5 top-level albums (categories), 38 nested albums (subcategories, most of them empty), and 3 actual photos (the site had not yet been populated). To get what I needed I had to do a little math:
Here I subtracted the number of top level albums ($numAlbums (i.e. 5)) from the total number of all albums plus photos ($numAccessibleAlbums (i.e. 46 (5+38+3))). (i.e. 46-5=41). Then I subtracted this from the total number of sub- (nested) albums plus photos ($numPhotos (i.e. 44 (41+3)). (i.e. 44-41=3). This gave me the number of actual photos, independent of albums.
I then juggled the following lines:
and commented out:
so that it now displays: 3 photos in 5 categories
and doesn't mention the number nested albums (which I don't really need).
All this without knowing squat about php! --pats self on back--
Hope this helps someone else... LEN
LEN
Posts: 3474
Yep... the search engine is pretty powerful, but sometimes it's hard to find what you want, since we all call the same things by very different names! Next time... just post a quick question here before embarking on anything major--just in case it's already been done.
Posts: 110
what is the difference between the patch of len and that one in the previous thread which is quoted here above? The previous one counts subalbums as photo's too?
I would like to install the same as Len in that case. How do I go about this? Do I first have to install the patch and then do some manual hacking as Len?
I have never used a patch before.....
And will it work with files that already have been manually altered?