Member
Member
arien123   2009-02-22, 07:19
#1
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.
Administrator
Administrator
acrylian   2009-02-22, 10:30
#2
You can write a mysql query to get all that info.
Member
Member
dendraya   2009-02-23, 00:30
#3
you can try this php code: $photosArray = query_single_row("SELECT count(*) FROM ".prefix('images')); $photosNumber = array_shift($photosArray); echo $photosNumber
Member
Member
sh123   2009-02-25, 15:41
#4
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. Smile
Member
Member
sbillard   2009-02-26, 01:53
#5
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.
Member
Member
sh123   2009-02-26, 18:18
#6
The "Image" table has "AlbumId" as field. I am having hard time writing mySQL query with albumname as field. Pls. Help.
Administrator
Administrator
acrylian   2009-02-26, 18:40
#7
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.
Member
Member
sh123   2009-03-14, 17:32
#8
RESOLVED # Finally looked into template functions. We do have function getTotalImagesIn($_zp_current_album) for this. It works great. Thanks.
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.