This is not very difficult with smarty.
In the template source field you see a foreach loop. If you replace that with this code, you get what you want. Probably some change to the css is nescesary to not see the empty links, just assign the border to the image in stead of the <a>element.
Code: Select all
{assign var='firstimage' value='1'}
{foreach from=$images item=image}
<div class="img">
{if $image->isdir}
<a href="{$image->file}" title="{$image->title}"><img src="{$image->thumb}" alt="{$image->title}" /></a><br />
{$image->title}
{elseif $firstimage}
<a href="{$image->file}" title="{$image->title}" rel="lightbox[gallery]"><img src="{$image->thumb}" alt="{$image->title}" /></a>
{assign var='firstimage' value='0'}
{else}
<a href="{$image->file}" title="{$image->title}" rel="lightbox[gallery]">{* no thumb here *}</a>
{/if}
</div>
{/foreach}
Note that you can't use the smarty code
$smarty.foreach.foo.first here, because it may well be that the first item is a subgallery.