I want the next button to link to the first image of the album when the last image is showing. I don't see a function that give me the link to the first image.
any ideas ...?
or you could possibly just add a function like getPrevImageURL() and call it getFirstImageURL() in template-functions.php, something like this I think:
`
/**
Returns the url of the first image in current album.
@return string
*/
function getFirstImageURL() {
if(!in_context(ZP_IMAGE)) return false;
global $_zp_current_album, $_zp_current_image;
$firstimg = $_zp_current_album->getImage(0);
return rewrite_path("/" . pathurlencode($firstimg->album->name) . "/" . urlencode($firstimg->filename) . im_suffix(),
"/index.php?album=" . urlencode($firstimg->album->name) . "&image=" . urlencode($firstimg->filename));
}`
@acrylian: echo Next didnt work. i had to change $firstimage to $firstimage[0]. That did the trick thanks.
@gerben: thanks for looking in to it, i decided to use acrylian's method because i will forget that i changed the functions file and with an update i will get lost This way it is easy for me to change if necessary.
I actually just added this on my site, i just made that getFirstImageURL() function and similarly a getLastImageURL() function to get the url to the last image in the album.
to get the last image I used:
'$lastimg = $_zp_current_album->getImage($_zp_current_album->getNumImages() - 1);'
and then I changed the links to the next and previous picture in image.php like this:
'a href=""'
'a href=""'
This works fine.