Pages (3):    1 2 3   
Member
Member
Wete   2012-02-03, 15:44
#21
Not in my "own" loop, but in the next_image-loop when zenphoto generates the thumbnails (the visible links Wink )

here:

`

<?php while (next_image()): ?>
<div class="image">
<div class="imagethumb"><a class="fancyalbum" rel="album" href="<?php echo html_encode(getUnprotectedImageURL());?>" title="<?php echo html_encode(getAnnotatedImageTitle()).' (xx/'.getNumImages(); ?>)"><?php printImageThumb(getAnnotatedImageTitle()); ?></a>
</div>
<?php endwhile; ?>
</div>
`
instead of the "xx"
Administrator
Administrator
acrylian   2012-02-03, 15:55
#22
Then use `imageNumber()`.
Member
Member
Wete   2012-02-03, 15:59
#23
marvelous!!! Smile
Member
Member
Wete   2012-02-03, 16:24
#24
*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
Member
Member
Wete   2012-02-03, 16:57
#25
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
Administrator
Administrator
acrylian   2012-02-03, 17:17
#26
Not really, as only next_image() in "standard theme usage" does calculate that actually.
Member
Member
Wete   2012-02-03, 17:21
#27
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
Member
Member
sbillard   2012-02-03, 18:02
#28
`
$images = $album->getImages(0);
foreach ($images as $imagename) {
$image = newImage($album, $imagename);
<your code goes here>
}
`
In other words, you need to revert to the object model when the built-in functions do not do what you need.
Member
Member
Wete   2012-02-03, 18:29
#29
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
Member
Member
Wete   2012-02-03, 18:45
#30
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
Administrator
Administrator
acrylian   2012-02-03, 19:11
#31
I suggest to take a look at next_image()'s code.
Member
Member
Wete   2012-02-03, 19:11
#32
Solved it - with absolute values right now. Maybe I look for the variables for "thumbs on each row / page" ...

`
<?
$albumseiten = getTotalPages();
$aktuelleseite = getCurrentPage();
$subalbumzeilen = floor(($_zp_current_album->getNumAlbums() + 2) / 3);
$thumbsersteseite = (12 - (3 * $subalbumzeilen));
if (($albumseiten > 1) AND ($aktuelleseite > 1)) {
for($vorseite = 1; $vorseite < $aktuelleseite; ++$vorseite) {
$bilder = $_zp_current_album->getImages($vorseite, $thumbsersteseite);
$i=0;
foreach ($bilder as $bild) {
$bild = $bilder[$i];
$imageobject = newImage($_zp_current_album,$bild);
$bildnummer = $imageobject->getIndex()+1;
++$i;
echo'<a class="fancybox" rel="album" href="'.$imageobject->getFullImage().'" title="'.$imageobject->getDefaultTitle().' ('.$bildnummer.'/'.$_zp_current_album->getNumImages().')"></a>'."\n";
}
}
}
?>


<?php while (next_image()): ?>
<div class="image">
<div class="imagethumb"><a class="fancybox" rel="album" href="<?php echo html_encode(getUnprotectedImageURL());?>" title="<?php echo html_encode(getAnnotatedImageTitle()).' ('.imageNumber().'/'.getNumImages(); ?>)"><?php printImageThumb(getAnnotatedImageTitle()); ?></a>
</div>
<?php endwhile; ?>

<?
$albumseiten = getTotalPages();
$aktuelleseite = getCurrentPage();
$subalbumzeilen = floor(($_zp_current_album->getNumAlbums() + 2) / 3);
$thumbsersteseite = (12 - (3 * $subalbumzeilen));
if (($albumseiten > 1) AND ($aktuelleseite < $albumseiten)) {
for($nachseite = ($aktuelleseite+1); $nachseite < ($albumseiten+1); ++$nachseite) {
$bilder = $_zp_current_album->getImages($nachseite, $thumbsersteseite);
$i=0;
foreach ($bilder as $bild) {
$bild = $bilder[$i];
$imageobject = newImage($_zp_current_album,$bild);
$bildnummer = $imageobject->getIndex()+1;
++$i;
echo'<a class="fancybox" rel="album" href="'.$imageobject->getFullImage().'" title="'.$imageobject->getDefaultTitle().' ('.$bildnummer.'/'.$_zp_current_album->getNumImages().')"></a>'."\n";
}
}
}
?>
`
Wete
Member
Member
Wete   2012-02-03, 19:12
#33
I read the next_image()'s code, but I felt like I did not reach the Age of Enlightment right now. Smile
Administrator
Administrator
acrylian   2012-02-03, 19:29
#34
Great..:-)
Member
Member
sbillard   2012-02-04, 00:53
#35
There is a global varaiable `$_firstPageImages` which should contain the number you want. If it is not setup then you need to call the `setThemeColumns()` function.
Member
Member
Wete   2012-02-04, 16:51
#36
Great. This saved 2 hours of brain-squeezing - if I had known this fact yesterday.
Smile
Member
Member
ferentz   2012-09-26, 16:24
#37
Exactly what I was needing. Thank you very much Wete for sharing your code!

Regards,
Adrian
Member
Member
ferentz   2012-09-28, 17:03
#38
Sorry for bringing this thread up again.. I have a little problem with this piece of code from Wete's script:

`$imageobject->getDefaultTitle()`

Printing the title attribute for the hidden links doesn't print the string value from the database, it just prints the filename without the extension (i.e. "filename_13" instead of "Filename Thirteen"). This messes up the image presentation a bit for paginated albums. All of this is happening while it's counterpart in the visible thumb links loop

`<?php echo html_encode(getAnnotatedImageTitle()); ?>`

works just fine.. Also I would like to know if there is any way to get the image description?

(Something similar to this
`<?php echo html_encode(getImageDesc());?>`
I have tried looking here but with no succes http://www.zenphoto.org/documentation/classes/_Image.html )

Thank you very much!
Administrator
Administrator
acrylian   2012-09-28, 17:16
#39
Of course, you can get everything via the object model. `$imageobject->getDesc()`. `$imageobject->getTitle()`. The image class has parent classes shared with albums that provides this by inheritance (one definition for both):
http://www.zenphoto.org/news/zenphotos-object-model-framework#zenphotos-main-classes
Member
Member
ferentz   2012-09-29, 12:08
#40
Thank you very much Acrylian. It seems I really must spend some time learning about php object programming and zenpohto object model.

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