ZenphotoCMS Forum
total number of images - 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: total number of images (/thread-2290.html)

Pages: 1 2


total number of images - gregluk - 27-02-2008

Hi to all.
I made my own theme, and now i want to show the total number of the images i have in different albums. I'd like to have it on the index.php page of my template.
I noticed that if i use the getTotalImagesIn function without parameters it didn't work.
I'm pretty ignorant in php
I tried this but it dont work

  1. $number .= " photos"; else $number .=" photo"; echo$number; ?>

Any help???

Thanks in advance




total number of images - acrylian - 27-02-2008

Try getNumImages() instead of getTotalImagesIn().




total number of images - gregluk - 27-02-2008

alredy tried. It seems wherever I insert getNumImages() or getTotalImagesIn() functions in the index.php page it simply block the page.
It seems to work on my album.php page instead.
I wonder why.. Missing parameters?
If u want to take a look my ZP gallery is in filmposter.netsons.org/zenphoto/index.php




total number of images - acrylian - 27-02-2008

You need to place getNumImage() within the albums loop that starts with `` since it returns only the images of one album. getTotalimages instead returns the number of images in an album and all of it's subalbums.
Please take a look at our functions guide, too.

If you mean the total number of all images in all albums? There is no function for that if I recall correctly. Use something like this:
``(taken from stopdesign theme).

Probably worth considering a standard function for that.




total number of images - jsumners - 27-02-2008

From class-gallery.php:

`

224 /**

225 Returns the number of images from a database SELECT count()

226 * Ideally one should call garbageCollect() before to make sure the database is current.

227 * @return int

228 */

229 function getNumImages() {

230 $result = query_single_row("SELECT count(*) FROM ".prefix('images'));

231 return array_shift($result);

232 }

`




total number of images - acrylian - 27-02-2008

Oh, right, there it is... To make it complete, gregluk, use it this way ``




total number of images - gregluk - 27-02-2008

Thanks a lot. Now i'll give a try to your tips. Indeed i'm looking for a function that returns total numbers of images in the whole gallery, as shown in the gallery stats on the admin page. There it works, i hoped there was something similare for the templates.
If u look at my pages, u'll find that i did 26 albums (A, B, C, etc.) to make a gallery browsable by the starting letter of an image's name. So a function that returns total numbers of images in all allbums would be nice for me.

Thanks a lot and please excuse my english, I'm from Italy




total number of images - selim - 17-03-2008

also you can use for total images in sub albums.




total number of images - MelodyNelson - 05-06-2008

hi,

I'm looking for a function like getNumImages() but I would like to exclude images from unpublished albums, is it possible ?

in my template, I use this code

[code]

[/code]

I have a lot of unpublished albums (images and docs used in a CMS, files are shared between the CMS and ZP). Around 60% of images are in unpublished albums (± 2500 images)

thanks

ps: sorry for my english, I'm french




total number of images - acrylian - 05-06-2008

I haven't tried yet, but if you are logged in there are no "unpublished" albums/images. The admin sees them all.

Actually getNumImages() gets only the image count of the current selected album.
You could try instead using the gallery class method $_zp_gallery->getNumImages() that gets the count of all images of your gallery.




total number of images - MelodyNelson - 05-06-2008

thanks acrylian

I've tried but the count is the same with $_zp_gallery->getNumImages()
I tried to see with orther browsers, clean all cookies, history, etc... but I have the total of images (published and unpublished albums)
I don't know if the problem is coming from my computer or not, you can see my gallery (still under construction) here :
http://www.bilin-village.org/photos/




total number of images - macalter - 05-06-2008

gregluk: WOW Love the site even if I can't read the words What PHP function did you use to add "subtitles" to the thumbnails (album.php page)?




total number of images - acrylian - 05-06-2008

What is the number of images you have? I see a count of 4816 .




total number of images - MelodyNelson - 05-06-2008

1813 images in 18 published albums ... and 4816 in all abums




total number of images - acrylian - 05-06-2008

Ok, we found out that this function does indeed not care about published or not. We will have a fix in one of the next nigthlies.




total number of images - MelodyNelson - 05-06-2008

ok thanks, I'll check it... and thanks for zenphoto, really nice "tool"... I could manage to include albums and recent images in other pages from my website (powered by Plume CMS)

  • a happy new user



total number of images - sbillard - 05-06-2008

Tonight's nightly build will allow you to pass a parameter $gallery->getNumImages(true) to return the count of only published images. Likewise $gallery->getNumAlbums(true, true) for published albums.




total number of images - gregluk - 06-06-2008

Please "pardonnez moi" OT..
Hi macalter, thanks for your good words. That was a site I did a lot time ago. I programmed to translate it into english but i never did it...
To make subtitles to image thumbnails I symply made a div beneath the div with the thumbnail with in it. A little adjustament by CSS and it worked very fine




total number of images - MelodyNelson - 06-06-2008

hi,

I've updated my ZP install with the latest nighly version (5/06) and tried $gallery->getNumImages(true) but the count is still the total of all images (I'm not logged on the gallery)... must I uncheck "visible" for images in unpublished albums ?

Gallery (http://www.bilin-village.org/photos/) :

  • albums : 18 - 1806 images
  • total images : 4752

Admin Tool (Gallery Stats)

  • 4752 images (2884 unpublished)
  • 39 albums (18 unpublished)



total number of images - acrylian - 06-06-2008

It's working for me with the latest svn 1679, please try tonight's nightly again.