Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Adding a lightbox image: control 'normal' size?

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: 1445 Views
  • pinkp
    Avatar
    Community Member
    168 Posts

    Adding a lightbox image: control 'normal' size? Link to this post

    I have added this code to my image gallery to include another image in the lightbox gallery its works perfectly apart from the config settings don't change the 'normal' size of the image (when it pops up). It just appears full size!
    How do I do this please?

    GalleryUI_layout.ss

    <% if CoverImage %>
    <div id="MainImage"><a id="ViewLink" rel="lightbox" class="lightbox" title="$AlbumTitle" href="$CoverImage.URL"><% control CoverImage.SetWidth(250) %>
                   <img src="$URL"<% end_control %>alt="$AlbumName"/></a><p>$MainImageTitle</p></div>
    <% end_if %>

  • UncleCheese
    Avatar
    4085 Posts

    Re: Adding a lightbox image: control 'normal' size? Link to this post

    Look at your href:

    href="$CoverImage.URL"

    You're linking to the original image, with no resampling. Don't you want something like $CoverImage.SetWidth(500).URL?

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Adding a lightbox image: control 'normal' size? Link to this post

    IT doesn't work it just shows .URL on the front end and the link is broken. I tried the other way around .URL first still not luck. Do you know another way? many thanks!

  • UncleCheese
    Avatar
    4085 Posts

    Re: Adding a lightbox image: control 'normal' size? Link to this post

    <% control CoverImage %><% control SetWidth(500) %>$URL<% end_control %><% end_control %>

  • pinkp
    Avatar
    Community Member
    168 Posts

    Re: Adding a lightbox image: control 'normal' size? Link to this post

    That works great thank you!

    for any one else who needs it this is how my code looks in GalleryUI_layout.ss:

    <a id="ViewLink" rel="lightbox" class="lightbox" title="$MainImageTitle.XML" href="

    <% control CoverImage %><% control SetHeight(500) %>$URL<% end_control %><% end_control %>
    "><% control CoverImage.SetWidth(250) %>
                   <img src="$URL"<% end_control %>alt="$AlbumName" title="$AlbumName"/></a>

    1445 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.