Is it possible to call the first image of the first album directly into index.php? Currently I have to click through the link for an album, and then choose an image in order to see anything. That's a few more steps than I'd like. Ideally when the link to the zenphoto site is clicked the code would serve the first image up. I've already built the links to the other albums and the thumbnails for the current album into image.php so there's a way back. I'd rather not have to hard-code the link to the first image since this is for a client and it's quite possible that link would have to change regularly. Perhaps something like the "set context" call but for the first album of the set?
[b] Is it possible to call the first image of the first album directly into index.php? Currently I have to click through the link for an album, and then choose an image in order to see anything. That's a few more steps than I'd like.
[/b]
I would also like to have this feature. Does anyone know how to get this to work?
try:
`global $_zp_gallery;
$alb = $_zp_gallery->getAlbums(0);
$first = $alb[0];
$firstAlbum = new Album($_zp_gallery, $first);
$img = $firstAlbum->getImages(0);
$first = $img[0];
$firstImage = new Image($firstAlbum, $first);`
Sorry but I must have misinterpreted Genial's request. I guess my question is different.
What I would like to have is the normal index page that lists albums with thumbnails, but instead of showing the album view when a user clicks on a thumbnail from the index page, I would like it to link to the album's first image. Is there a way I could sidestep the album view page?
That really depends on where you want the thumbnail to appear on the page.
A quick tour of the code above:
the gallerytitle div is where the name and link back to the gallery page is done.
the images is where your image thumbnails are generated.
Note: this theme would not support subalbums. If you are really new to all this I suggest you take one of the existing themes--say the example theme (which is called testing in the 1.1.2 release) as a starting point.
It is index.php which shows the first level albums. Second level albums (subalbums) are normally shown by the album.php page. However what you have above does not do them.
Thank you for the info about subalbums. I do not plan on using subalbums on my site so updating is not necessary.
I have tried replacing the images div with your code on my album page, but I get a fatal error from the $img = $album->getImages(0); line.
Where on the album.php should I add your code?
Perhaps it would be easier for the album link on the index.php page to link straight to the first image of the album. Would this be possible?
I have tried placing your code on my album.php page and then on my index.php page, and both return the following error:
[b]Fatal error: Call to a member function getImages()
[/b]
Is this a new function for ZenPhoto 1.1.2, or should I put the code somewhere else?
I have edited the code above to correctly use $firstAlbum. Please be sure that you take example code with a grain of salt. Obviously I have not implemented this function. I am trying to give you examples of how to do something. However, it is not final polished code and is created on the spur of the moment. You need to be able to understand what is attempted and make modifications as needed to make the code correct. If this is too much for you, then perhaps you should not be taking on this project.
I got it to work kind of!
I upgraded to 1.1.2, put your new code on index.php and changed getAlbumLinkURL() to $firstImage->getImageLink();.
It does work, except now all of the thumbnails on the index page point to the first photo of the first album. I played around a little and noticed that if I change the number from 0 to 1 in the $first = $alb[0]; line, the thumbnails would then link to the first image of the second album.
Is there a way for each of the albums on index.php to have their own link be first image of their album?
Here's my index.php file:
`