Gallery get album cover in foreach!

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Cyc
Forum Members
Forum Members
Posts: 91
Joined: Wed Nov 18, 2015 11:54 pm

Gallery get album cover in foreach!

Post by Cyc »

Hello, I have this template:

Code: Select all

{if $images}
{foreach from=$images item=image}
{if $image@first}
  {$src={$image->file}}
  {$alt={$image->titlename}}
{/if}
{if $image->[b]iscover[/b]}
  {$src={$image->file}}
  {$alt={$image->titlename}}
{/if}
{/foreach}
<img src="{$src}" alt="{$alt}">
{/if}
It is possible to get album cover?
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Gallery get album cover in foreach!

Post by velden »

IIRC cover is a property of a gallery and not of an image. So I think you can't easily get it this way.
Further I also think the cover is saved with the Gallery as a link/url to the image.

So if you get the cover of the gallery you'd have to compare it with the link to each image (in your foreach) loop to get a match
Post Reply

Return to “Modules/Add-Ons”