Pages (2): 1 2   
Member
Member
gregluk   27-02-2008, 12:49
#1

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

Administrator
Administrator
acrylian   27-02-2008, 16:23
#2

Try getNumImages() instead of getTotalImagesIn().

Member
Member
gregluk   27-02-2008, 20:46
#3

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

Administrator
Administrator
acrylian   27-02-2008, 21:29
#4

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.

Member
Member
jsumners   27-02-2008, 21:48
#5

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 }

`

Administrator
Administrator
acrylian   27-02-2008, 21:56
#6

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

Member
Member
gregluk   27-02-2008, 22:41
#7

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

Junior Member
Junior Member
selim   17-03-2008, 19:05
#8

also you can use for total images in sub albums.

Member
Member
MelodyNelson   05-06-2008, 03:03
#9

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

Administrator
Administrator
acrylian   05-06-2008, 09:13
#10

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.

Member
Member
MelodyNelson   05-06-2008, 15:34
#11

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/

Member
Member
macalter   05-06-2008, 16:36
#12

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)?

Administrator
Administrator
acrylian   05-06-2008, 16:44
#13

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

Member
Member
MelodyNelson   05-06-2008, 16:52
#14

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

Administrator
Administrator
acrylian   05-06-2008, 16:58
#15

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.

Member
Member
MelodyNelson   05-06-2008, 17:14
#16

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
Member
Member
sbillard   05-06-2008, 19:45
#17

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.

Member
Member
gregluk   06-06-2008, 00:36
#18

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

Member
Member
MelodyNelson   06-06-2008, 16:22
#19

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)
Administrator
Administrator
acrylian   06-06-2008, 16:41
#20

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

Pages (2): 1 2   
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.