Jump to:

7937 Posts in 1537 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Image gallery different view

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: 1404 Views
  • gabriel
    Avatar
    Community Member
    7 Posts

    Image gallery different view Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image gallery different view Link to this post

    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?

  • gabriel
    Avatar
    Community Member
    7 Posts

    Re: Image gallery different view Link to this post

    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

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image gallery different view Link to this post

    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!

  • gabriel
    Avatar
    Community Member
    7 Posts

    Re: Image gallery different view Link to this post

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

  • Ryan M.
    Avatar
    Community Member
    309 Posts

    Re: Image gallery different view Link to this post

    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.

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