gallery.php to first image - skip album.php

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:

<h3>" title="<?php echo gettext('View album:'); ?> <?php echo getBareAlbumTitle();?>"><?php printAlbumTitle(); ?></h3>

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

Comments

  • acrylian Administrator, Developer
    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):
    `
    <?php $firstimage = $_zp_current_album->getImages(); ?>
    ">(...)(
    `
    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();
    ">(...)(
    `
  • Acrylian, you have saved the day again! Thanks so much!
  • acrylian Administrator, Developer
    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.
Sign In or Register to comment.