Member
Member
ksvendsboe   2009-05-14, 01:27
#1

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

Administrator
Administrator
acrylian   2009-05-14, 07:45
#2

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();
(...)(
`

Member
Member
ksvendsboe   2009-05-14, 21:48
#3

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

Administrator
Administrator
acrylian   2009-05-15, 08:07
#4

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.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.