Page 1 of 1

Gallery get album cover in foreach!

Posted: Mon Aug 17, 2020 5:40 pm
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?

Re: Gallery get album cover in foreach!

Posted: Tue Aug 18, 2020 8:50 am
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