ZenphotoCMS Forum
Get url of first image in the next/previous album - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Get url of first image in the next/previous album (/thread-6643.html)



Get url of first image in the next/previous album - lordflake - 2010-02-22

Hi,

I'm trying to generate a link to the next album but I would like to skip the album view completely. It looks as if for this to occur I need to generate a link to the first image in the next album, not just a link to the next album.

If anybody could give any pointers on how to do this, it would much appreciated. Thank you.

L




Get url of first image in the next/previous album - acrylian - 2010-02-22

We have functions like this but those are album context sensitive so they are for the current album not the next.
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetFirstImageURL
http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetLastImageURL

You will have to work with the object model framework.




Get url of first image in the next/previous album - lordflake - 2010-02-22

Hi Acrylian,

Thanks for your answer. That's what I figured having looked at the available functions. Could you help me out a bit more by expanding on how to use the object model framework please? That's the bit I'm stuck on.

L




Get url of first image in the next/previous album - acrylian - 2010-02-22

We have a short tutorial about the basics in the works if you can wait a little.




Get url of first image in the next/previous album - lordflake - 2010-02-22

Thanks - that'll be really helpful.

I've managed to bodge a solution together, but I've no idea if it's sound...

`

$PrevAlbum = getPrevAlbum();

$firstimg = $PrevAlbum->getImage(0);

echo rewrite_path("/" . pathurlencode($PrevAlbum->name) . "/" . urlencode($firstimg->filename) . im_suffix(), "/index.php?album=" . urlencode($PrevAlbum->name) . "&image=" . urlencode($firstimg->filename));

`

L




Get url of first image in the next/previous album - acrylian - 2010-02-22

Actually quite good. Here a little help:
Insert this after the 2nd line:
$imgobj = newImage($prevAlbum,$firstimg); $firstimageeurl = $imgobj->getImageLink();