ZenphotoCMS Forum
Any workaround # number of images counting ALL subalbums - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Any workaround # number of images counting ALL subalbums (/thread-4685.html)



Any workaround # number of images counting ALL subalbums - arien123 - 2009-02-22

The function int getNumImages( ) only provides number of images in this album (not counting its sub albums)

Is there any work around if I want to show ALL images INCLUDING ALL sub albums?


Pls. advise. I am using latest nightly build.
Many thanks in advance.




Any workaround # number of images counting ALL subalbums - acrylian - 2009-02-22

You can write a mysql query to get all that info.




Any workaround # number of images counting ALL subalbums - dendraya - 2009-02-23

you can try this php code: $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray); echo $photosNumber




Any workaround # number of images counting ALL subalbums - sh123 - 2009-02-25

It pints the total number of images in the entire gallery. What I want is the total number of images in the particular album including its subalbums.

I think it may be a mySQL query where query could be (it counts number of images where album id equals array of all subalbumIds (function getAllSubAlbumIDs($albumfolder=''))

OR

just the count of albumids (Image table) where albumids equals array of all subalbumIds (function get AllSubAlbumIDs())

I am not good with mySQL. Any help would be much appreciated.

PS. Thanks dendraya for coming back to zenphoto after a long break.




Any workaround # number of images counting ALL subalbums - sbillard - 2009-02-26

Add a where clause to your query: WHERE folder like "%albumname%" (albumname needs to be the actual name of the album for which you want the coung.




Any workaround # number of images counting ALL subalbums - sh123 - 2009-02-26

The "Image" table has "AlbumId" as field. I am having hard time writing mySQL query with albumname as field. Pls. Help.




Any workaround # number of images counting ALL subalbums - acrylian - 2009-02-26

You need to query both the images and the albums table to get what you want. For an example of such a combined query look at the image_album_statistics-plugin around line 348 or visit the mysql doc.




Any workaround # number of images counting ALL subalbums - sh123 - 2009-03-14

RESOLVED # Finally looked into template functions. We do have function getTotalImagesIn($_zp_current_album) for this. It works great. Thanks.