7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Question re Album Cover Images
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 479 Views |
-
Question re Album Cover Images

28 August 2011 at 1:41pm
Hi, all. I'm a newbie to SS, and am having some difficulty working with image_gallery.
I'm trying to cause a page to display an album's cover art as well as all the images in the album in a list of thumbnails, with clicking on the cover art or any of the thumbnails bringing up a shadowbox via shadowbox.js. I am able to access the thumbnails, but not the album's cover art.
Code below:
HTML code, using a page that extends ImageGalleryPage.php
<ul>
<% control GalleryItems %>
<li><a href="$Image.URL" rel="shadowbox[gallery]">$Image.CroppedImage(100,60)</a></li><% end_control %>
</ul>This code displays a nice list of everything in the album, but I also need the cover art. I attempted to get access to the album cover art this way:
<% control Albums %>
<% control FormattedCoverImage %>
<a href="$Image.URL" rel=" ">$Image.CroppedImage(300,200)</a>
<% end_control %><ul>
<% control GalleryItems %>
<li><a href="$Image.URL" rel="shadowbox">$Image.CroppedImage(100,60)</a></li>
<% end_control %>
</ul><% end_control %>
Nothing displays from the first control, but the second control continues to work.
What's the proper way to do this?
-
Re: Question re Album Cover Images

30 August 2011 at 6:52am
FormattedCoverImage() returns an Image object, so you don't need to traverse to to $URL like that. It's already in scope.
GalleryItems, on the other hand, returns ImageGalleryItem objects, which have a relation to an Image, so you need to traverse to it..
---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com
| 479 Views | ||
|
Page:
1
|
Go to Top |

