I'm using the 'example' theme and I'm trying to figure out how to get the first image of an album.
Well what I'm REALLy trying to do is to skip the second level album page and just jump right in to the image view.
Example:
from zenphoto gallery list I click on a gallery that has a sub gallery. Instead of showing the list of galleries upon clicking the thumbnail, I want it to simply go straight to displaying the first image of the list. For this, I figured I would have the thumbnail of the sub gallery to have a url to the first image instead of the url to the gallery itself.
Confused? Me too
Comments
in template-functions.php (in 'example' theme) there is a method 'getAlbumLinkURL' I would like to have a check so it appends the first image to the url if it is a sub album.
if (is a sub album){
//get the first image
//append it to the end of the url
// eg. return <zenpath>/index.php?album=ALBUM%2FSUBALBUM&image=IMGNAME.JPG
}
else
{//do what it does now
return rewrite_path("/" . pathurlencode($_zp_current_album->name) . "/",
"/index.php?album=" . urlencode($_zp_current_album->name));
}
You can create a custom function to do this and replace the two getAlbumLinkURL() calls with it:
`function getFirstImageLinkURL() {
global $_zp_current_album, $_zp_current_image;
$images = $_zp_current_album->getImages(); // array of images in sort order
$_zp_current_image = $images[0]; // first image
return getImageLinkURL();
}`
The album page is iterating through the albums ('while(next_album()'). what I need is for the thumbnails for the sub albums to load but to link to the first image in the sub album instead of the sub album page with the thumbnails of the images inside (essentially skipping this page).
return getAlbumLinkURL(). "&image=" . $_zp_current_image;
I removed the subalbum in the breadcrumb and I'm good to go.
Thanks for your quick response.