I needed this function, too, and tested the above solutions but they seem to skip pictures all the time. Then I found the code in another post which worked fine unless you have album pagination enabeled: Then it skips all images on the pages following page 1:
http://www.zenphoto.org/support/topic.php?id=67
Here is my little hack based on the post above:
1) Open "template-functions.php", locate and duplicate the following function (past the duplicate just below the original one):
`function next_image() {
global $_zp_images, $_zp_current_image, $_zp_current_album, $_zp_page, $_zp_current_image_restore;
if (is_null($_zp_images)) {
$_zp_images = $_zp_current_album->getImages($_zp_page);
if (empty($_zp_images)) { return false; }
$_zp_current_image_restore = $_zp_current_image;
$_zp_current_image = new Image($_zp_current_album, array_shift($_zp_images));
save_context();
add_context(ZP_IMAGE);
return true;
} else if (empty($_zp_images)) {
$_zp_images = NULL;
$_zp_current_image = $_zp_current_image_restore;
restore_context();
return false;
} else {
$_zp_current_image = new Image($_zp_current_album, array_shift($_zp_images));
return true;
}
}`
2) Then you have to do two very small modifications:
`function next_image_all() { /* Change the function name so that there's no conflict with original one */
global $_zp_images, $_zp_current_image, $_zp_current_album, $_zp_page, $_zp_current_image_restore;
if (is_null($_zp_images)) {
$_zp_images = $_zp_current_album->getImages(); /* Changed "getImages($_zp_images)" to "getImages()" */
if (empty($_zp_images)) { return false; }
$_zp_current_image_restore = $_zp_current_image;
$_zp_current_image = new Image($_zp_current_album, array_shift($_zp_images));
save_context();
add_context(ZP_IMAGE);
return true;
} else if (empty($_zp_images)) {
$_zp_images = NULL;
$_zp_current_image = $_zp_current_image_restore;
restore_context();
return false;
} else {
$_zp_current_image = new Image($_zp_current_album, array_shift($_zp_images));
return true;
}
}`
3) Then add the following code to image.php within your template (right below the <body>-tag would be perfect):
`<?php
$columns = 0;
$current_pic = getImageTitle(true);
while (next_image_all()) {
$columns++//
?>
<?php if ($current_pic == getImageTitle())
{
$imagecounter = $columns . " of " . getNumImages();
}
};
?>`
4) Now add the following code whereever you want the counter "X of XX" to be shown:
`<?php echo $imagecounter; ?>`
That's it. My PHP skills are mainly basic and I assume there might be a more elegant way but this works perfect for me. I implemented this hack on two website for clients recently (and a third one to come). Look here to see it in action:
www.christophclasen.de
www.eiscafe-tanduo.de/fotogalerien