Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Adding a lightbox image: control 'normal' size?


Go to End


5 Posts   1994 Views

Avatar
pinkp

Community Member, 182 Posts

20 May 2010 at 10:02am

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 %>

Avatar
UncleCheese

Forum Moderator, 4102 Posts

20 May 2010 at 12:57pm

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?

Avatar
pinkp

Community Member, 182 Posts

20 May 2010 at 8:04pm

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!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

21 May 2010 at 1:37am

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

Avatar
pinkp

Community Member, 182 Posts

21 May 2010 at 7:01am

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>