Is there a way to simply call the album cover for a specific gallery?
LadyHLG
Gallery Album Cover Images
Re: Gallery Album Cover Images
Darn! But thanks for the reply.
Can't really complain, its a great mod, I will see if I can come up with something but will also make a feature request, this would definitely make it easier to integrate with other mods (like blog) to link an album to a post and show the cover image in post summaries.
LadyHLG
Can't really complain, its a great mod, I will see if I can come up with something but will also make a feature request, this would definitely make it easier to integrate with other mods (like blog) to link an album to a post and show the cover image in post summaries.
LadyHLG
-
- Power Poster
- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
- Location: Brisbane, Australia
Re: Gallery Album Cover Images
Could you create a new gallery template and simply only output the album cover, then in your page template just reference that gallery template and ID?
Re: Gallery Album Cover Images
Can I?
I can't seem to figure out how to only call the cover when I only have the album dir info.
I can call images by image number but that doesn't help as the cover could be different from album to album.
I can't seem to figure out how to only call the cover when I only have the album dir info.
I can call images by image number but that doesn't help as the cover could be different from album to album.
-
- Power Poster
- Posts: 265
- Joined: Mon Mar 14, 2011 1:16 am
- Location: Brisbane, Australia
Re: Gallery Album Cover Images
Untested, but this might work.
In your Gallery template (called "album_cover" in this example):
Then call your gallery in your page template:
My thought process is this:
1. Assign a variable which includes the gallery path.
2. Call the Gallery module and choose only that gallery.
3. The assigned Gallery template captures the "thumb" image path, saved as a variable {$album_cover} that you can re-use in your page template.
I'm not sure whether {$image->thumb} only outputs a single image, but it might give you some ideas at the very least.
In your Gallery template (called "album_cover" in this example):
Code: Select all
{capture assign='album_cover'}
{foreach from=$images item=image}
{if $image->isdir}{$image->thumb}{/if}
{/foreach}
{/capture}
Code: Select all
{assign var='my_gallery_directory' value='your_gallery_path'}
{Gallery dir=$my_gallery_directory template='album_cover'}
1. Assign a variable which includes the gallery path.
2. Call the Gallery module and choose only that gallery.
3. The assigned Gallery template captures the "thumb" image path, saved as a variable {$album_cover} that you can re-use in your page template.
I'm not sure whether {$image->thumb} only outputs a single image, but it might give you some ideas at the very least.
Re: Gallery Album Cover Images
Thank-you for the reply, unfortunately, this doesn't work 
I think the problem is if you call it a specific gallery it pulls the information for the images and there doesn't appear to be anything in the $images array that indicates if an image is a cover image.
It will show the cover image if I loop through the list of galleries, but not if I pull the information for a specific gallery, the cover image link is part of the gallery info not the image info.
So if I have
MyGallery/SubGallery1
MyGallery/SubGallery2
etc.
And I want the cover image for SubGallery1.
If I call your template for MyGallery I will see all the cover images for each SubGallery but I don't need all those I only need the cover image for SubGallery1, but if I call SubGallery1, it loops through the images in that gallery but doesn't indicate which one is the cover image.
I hope that makes sense.
I think as indicated above I will have to do this with a UDT or hope that somewhere along the line the developer will add this as a feature.
All the same, thank-you, I really appreciate your help!
LadyHLG

I think the problem is if you call it a specific gallery it pulls the information for the images and there doesn't appear to be anything in the $images array that indicates if an image is a cover image.
It will show the cover image if I loop through the list of galleries, but not if I pull the information for a specific gallery, the cover image link is part of the gallery info not the image info.
So if I have
MyGallery/SubGallery1
MyGallery/SubGallery2
etc.
And I want the cover image for SubGallery1.
If I call your template for MyGallery I will see all the cover images for each SubGallery but I don't need all those I only need the cover image for SubGallery1, but if I call SubGallery1, it loops through the images in that gallery but doesn't indicate which one is the cover image.
I hope that makes sense.
I think as indicated above I will have to do this with a UDT or hope that somewhere along the line the developer will add this as a feature.
All the same, thank-you, I really appreciate your help!
LadyHLG