ZenphotoCMS Forum
gallery.php to first image - skip album.php - 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: gallery.php to first image - skip album.php (/thread-5181.html)



gallery.php to first image - skip album.php - ksvendsboe - 2009-05-14

Hi there,

I have found a lot of similar requests on the forum, but none seem to be quite as "simple" as what I am trying to do - my apologies if this has already been covered 100 times and I'm just not finding it.

I am trying to link from the album description/thumb links on my gallery.php page directly to the first image of the gallery in question. This is what the code for that looks like presently:

" title=" ">

I have tried to implement code that I have found in other forum discussions, but ended up with errors. If someone could please lend advice, I would be greatly appreciative. I am a PHP novice, but not completely clueless - I just beg that you be gentle!

Many thanks,

Kari




gallery.php to first image - skip album.php - acrylian - 2009-05-14

I assume you are familiar with Zenphoto themes. So within the next_album() loop (either on index.php or album.php, depending of your site's structure) use this to get the first image link instead of the normal albumlink that is in standard themes (modrewrite only):
`

.]">(...)(
or a little more elegant (with and without modrewrite):
$images = $_zp_current_album->getImages();
$firstimage = newImage($_zp_current_album,array_shift($images));
$link = $firstimage->getImageLink();
(...)(
`




gallery.php to first image - skip album.php - ksvendsboe - 2009-05-14

Acrylian, you have saved the day again! Thanks so much!




gallery.php to first image - skip album.php - acrylian - 2009-05-15

Also I forgot: We already have the function getFirstImageURL(). The above code is more useful if you do some custom theme stuff outside the standard next_album loop.