Display image number on image.php

Is there a way to display the "sequential" image number on the image.php page?

I.e., if there are four images in the album, when displaying the first image, you would have a field that read "1", when displaying the second image, the field would read "2", etc. (No need for showing total number in album.)

Thanks!

Comments

  • os07 Member
    Yes, sorry. It's right there. Looked at the file, but I guess not closely enough. Took all of ten seconds to implement, even for me.

    What I am trying to do is to have a visual link to each image in the album using the image's sequential number as the basis for the link. Kind of like having a little visual "menu" just consisting of image numbers, with the current image link always highlighted as the user moves through the images in the album.
  • os07 Member
    Is there a way to specify a specific image number (i.e., the image's number in the album's sequence)? I am not experienced much in PHP, I'm afraid.

    Thank you.
  • No single function, but as with most anything, there is a way:

    `$images = $_zp_current_album->getImages();

    $tenthimage = new Image($_zp_current_album, $images[10]);`

    Of course, you need to be sure there is such an image!
  • acrylian Administrator, Developer
    sbillard, I think he has something different in mind like this:
    `<?php $imgnr = imageNumber(); <br />
    $count =0;

    while (next_image(true)):

    $count++;

    if($count == $imgnr) {

    echo $count;

    } else {

    ?>

    " title="<?php echo getImageTitle();?>">

    <?php echo $count; ?>


    <?php }<br />
    endwhile; ?>

    `
    That prints a " 1 2 3 4 etc" list of the images in the album where the current image is not a link.
  • os07 Member
    Thank you. What I am trying to do is to have a little menu on the image page, so that under each image would be:

    1 2 3 4 5 ...

    And each number would be a link to that sequential image in the album. A different sort of navigation than the <prev> and <next> buttons.
  • acrylian Administrator, Developer
    That is exactly what my code above does.
Sign In or Register to comment.