(invisible) links to pictures before and after the actual album page

Hi everybody!

I'd prefer to use Fancybox instead of image.php to show the single images of an album. It's no problem to change the image links in album.php, so that I have a nice slideshow in Fancybox, but the problem is, that with this approach I only have those images, which are shown on the actual album page. Fancybox should show all images of the album - like the original slideshow of ZenPhoto.
To solve this problem, I could place invisible links `()` before and after the image thumbnails that contain exactly the complement image links. The other solution would be to show ALL images of an album on one album page, what would be problematic for large albums.
There is the function `$images = $album->getImages();`, but is there another function which gives back "all images on previous album pages" and "all images on next album pages"?

Greetings!
Wete
«1

Comments

  • acrylian Administrator, Developer
    To have any "box" script to show all images you have to invisibly generate a list of all the images you wish to show. This is how the Slideshow plugin in Colorbox mode does it.
  • Yeah, this was exactly my question.

    Now I only need the answer. (Images on previous pages, images on next pages ...)

    ;-)
  • acrylian Administrator, Developer
    Ahm, you answered yourself. Use the `getImages()` album class method to get all the images of the current album and then print them hidden via css for example.
  • Example: The album contains 50 images, 12 thumbnails are shown on each page -> 5 pages. On Page 1 there are thumbnails 1-12, so I need the (invisible) links to image 13-50. On page 2 the thumbs 13-24 are displayed, so I need links to 1-12 and 25-50 and so on ... I wondered if there are functions for this task.

    Wete
  • acrylian Administrator, Developer
    I don't understand. Do you want to show all images via a lightbox popup or not? If you don't need pagination, right? Again, if you use the method noted above with the right parameter set you get all images without pagination. Then print a invisible list of the links to the image and attach the gallery attributes fancy box (which I don't know) needs. Colorbox uses a del attribute for that.
  • I'd like to have the normal album-pages (album.php). But when you klick on a thumbnail, $box (e.h. fancybox) should be open - not image.php. Therefore I need the invisible links additionaly to the thumbnails. And I'd like to have the usual pagination for the album.php, because I do not want to show more than x thumbs per page (e.g. 12).

    Page 1: no invisible links / 12 thumbs / 38 inv. links
    Page 2: 12 inv. links / 12 thumbs / 26 inv. links
    Page 3: 24 inv. links / 12 thumbs / 14 inv. links
    Page 4: 36 inv. links / 12 thumbs / 2 inv. links
    Page 5: 48 inv. links / 2 thums / no inv. links

    Wete
  • Aaaah, perfect!
    So I only need values for "actual page" and "number of pages in this album". `getGalleryPage( )` should help. :)

    Thx!
    Wete
  • acrylian Administrator, Developer
    Exactly, now you got it..;-)
  • It works! :)
  • Problem:
    I now have a wonderful list of all images I need - but without path. I thought, this would work, but it does not. :-(

    `
    <?
    $galleryobject = new Gallery();
    $albumobject = new Album($galleryobject,$_GET['album']);
    $albumseiten = getTotalPages();
    $aktuelleseite = getCurrentPage();
    if (($albumseiten > 1) AND ($aktuelleseite > 1)) {
    for($vorseite = 1; $vorseite < $aktuelleseite; ++$vorseite) {
    $bilder = $albumobject->getImages($vorseite);
    $i=0;
    foreach ($bilder as $bild) {
    $bild = html_encode(getUnprotectedImageURL($bilder[$i]));
    ++$i;
    echo''."\n";
    }
    }
    }
    ?>
    `
    Wete
  • VERY dirty workaround:

    `
    $albumurl = '/galerie/albums'.substr(getAlbumLinkURL(), 8);
    `
  • acrylian Administrator, Developer
    Did you even look at our documentation, especially the object model tutorial?

    `
    $galleryobject = new Gallery();
    $albumobject = new Album($galleryobject,$_GET['album']);
    `
    http://www.zenphoto.org/news/zenphotos-object-model-framework#global-object-variables

    `getUnprotectedImageURL($bilder[$i])`
    http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetUnprotectedImageURL
  • Hm, looks as I have to read and learn ... *sigh*
  • acrylian Administrator, Developer
    A little..;-)
  • I learned!

    `
    <?
    $galleryobject = new Gallery();
    $albumobject = new Album($galleryobject,$_GET['album']);
    $albumseiten = getTotalPages();
    $aktuelleseite = getCurrentPage();
    if (($albumseiten > 1) AND ($aktuelleseite > 1)) {
    for($vorseite = 1; $vorseite < $aktuelleseite; ++$vorseite) {
    $bilder = $albumobject->getImages($vorseite);
    $i=0;
    foreach ($bilder as $bild) {
    $bild = $bilder[$i];
    $imageobject = newImage($albumobject,$bild);
    ++$i;
    echo'getFullImage().'">'."\n";
    }
    }
    }
    ?>
    `
  • acrylian Administrator, Developer
    Great..:-) Two notes: The gallery object is always available on theme scripts in `$_zp_gallery`. Additionally the current album object is available in `$_zp_current_album` if you are on album.php and image.php of a theme (also within the next_album loop).
  • One additional question: Is it possible to use `getIndex()` within the next_image-loop to get a description like "Image 2/72" (72 is `getNumImages()` and works)?

    Wete
  • acrylian Administrator, Developer
    Even easier. Just add a simple count to your loop.
    Update: You have the number of the image already, why not just echo `$i`?
  • Not in my "own" loop, but in the next_image-loop when zenphoto generates the thumbnails (the visible links ;) )

    here:

    `

    `
    instead of the "xx"
  • acrylian Administrator, Developer
    Then use `imageNumber()`.
  • marvelous!!! :)
  • *sigh*
    The whole system does not work properly in "mixed" albums because of the "wrong" number of thumbnails on the first album page. It's a pity.

    But there must be a solution. ZenPhoto knows which images have to be on page 2, even if there are less then the usual quantity on page 1.

    Wete
  • This seems to be a bug!

    `$_zp_current_album->getImages($page)` does not consider, if sub-albums do effect the number of image thumbnails!

    Wete
  • acrylian Administrator, Developer
    Not really, as only next_image() in "standard theme usage" does calculate that actually.
  • That means, there is no solution for my problem - to get a list of all image links before and after the actually shown set of image thumbnails. :-(

    Wete
  • `
    $images = $album->getImages(0);
    foreach ($images as $imagename) {
    $image = newImage($album, $imagename);

    }
    `
    In other words, you need to revert to the object model when the built-in functions do not do what you need.
  • With `$images = $album->getImages(0)` I get a list of all images in $album. What I need are 2 lists:

    - all images before the actually shown set of image thumbs
    - all images after the actually shown set of image thumbs

    No file should be listed twice, so that you can watch all images of the album in lightbox/fancybox/... in the given order and without repetitions or gaps. The first list + the set of thumbs + the second list would make such a list.

    Wete
  • If it would be possible to calculate, how many image thumbs are shown on page 1, I could set that value as parameter for `$firstPageCount` in `$images = $album->getImages`

    Wete
  • acrylian Administrator, Developer
    I suggest to take a look at next_image()'s code.
Sign In or Register to comment.