Jump to:

7940 Posts in 1543 Topics by 946 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Question re Album Cover Images

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 667 Views
  • JonC
    Avatar
    Community Member
    8 Posts

    Question re Album Cover Images Link to this post

    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?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Question re Album Cover Images Link to this post

    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

    667 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.