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.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Image gallery different view


Reply


6 Posts   1430 Views

Avatar
gabriel

Community Member, 7 Posts

11 June 2009 at 11:14am

Hi, I'm pretty new with Silverstripe but mostly with the Image Gallery. I know a bit of PHP but I don't know where to start in this case.

I don't want to open the photos in any of the options given, I'd like to open them in a page like any normal page. Any tips where to start with this? I don't really like the lightbox/javascript things, I want something more simple.

Thanks,
Gabriel

Avatar
UncleCheese

4086 Posts

11 June 2009 at 3:20pm

The right way to do it would be to extend the class into your custom implementation, but if you're new to SS and PHP, here's a possible hack of a solution.

Set the images per page to 1, set the thumbnail width to something large, say, 640px, and set the popup style to "none"

Ostensibly, that would have the same effect, wouldn't it? :)

Avatar
gabriel

Community Member, 7 Posts

11 June 2009 at 6:38pm

In some way, yes it would be similar, but I'd lose the album view if I do that. If I have about 50 photos in the same album, and you want to look at a specific photo, it a bit more complicated for the end user.

I guess I'll have to live with the Javascript, I can't seem to understand how to do it, it's more complicated than dealing with Pages and Holders as shown in the docs ;) .

Thanks anyway.

Gabriel

Avatar
UncleCheese

4086 Posts

12 June 2009 at 2:16am

You would still have the album navigation in the subnav. Keep in mind you should be copying the ImageGallery templates into your mysite directory so you can customize them.

If you wanted images in lieu of numbers for pagination, you could do something like this:

function GalleryPagination()
{
$pages = new DataObjectSet();
$i=1;
foreach($this->GalleryItems() as $item) {
$pages->push(new ArrayData(array(
'ThumbnailURL' => $item->Image()->CroppedImage(50,50)->URL,
'Link' => $this->CurrentAlbum()->Link()."?start=".$i;
)));
$i++;
}
}

Then something like

<% control GalleryPagination %>
<li><a href="$Link"><img src="$ThumbnailURL" /></a></li>
<% end_control %>

Easy peasy!

Avatar
gabriel

Community Member, 7 Posts

12 June 2009 at 5:14am

Something's not working with that, but I should be able to figure it out. Thanks a lot for that tip!

Avatar
Ryan M.

Community Member, 309 Posts

5 January 2010 at 1:21pm

I'm trying to do this and I would like to know if anybody has any success in getting something like this to work? If so, please post your code.

What I want to do is change the thumbnail links to link to an image page instead of the lightbox things, so members can comment on & rate the images. The comments & ratings will be my own modifications as well.