Jump to:

10378 Posts in 2194 Topics by 1710 members

All other Modules

SilverStripe Forums » All other Modules » Image Gallery Extension: Testers Needed

Discuss all other Modules here.

Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w

Go to End
Author Topic: 67014 Views
  • jhirm
    Avatar
    Community Member
    21 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    Yeah, the decorators have been giving me grief. I didn't think it would work to extend the ImageGalleryItem directly since the ImageGalleryPage class includes the ImageGalleryItem in its has_many array, which would mean editing the ImageGalleryPage class, defeating the purpose of separating my additions into a separate module. However, after thinking about it a bit, your suggestion may actually work, since I CAN decorate the ImageGalleryPage successfully... I'll try it this afternoon.

    On an entirely unrelated note, I'm also working on a module that organizes various SilverStripe features into a package for user-management. In working on this, I noticed that the die() statement used to render a single album gallery breaks the built-in SS security model. For example, if you create a Page with Access set to a specific user-group, then make a Image Gallery Page as a child of the secured page, it is still possible to access the gallery via its URL if there is only one album because the die() statement stops further PHP execution. My quick fix was to change the die() to a redirect like this:

    if($this->SingleAlbumView()) {
       //FIX: changed die() to redirect to only album in order to solve security issue...
       $gallery_ID = $this->data()->getField("ID");
       $gallery_URLSegment = $this->data()->getField("URLSegment");
       $album = ImageGalleryAlbum::get_one("ImageGalleryAlbum", "ImageGalleryPageID = ".$gallery_ID);
       $album_URL = $gallery_URLSegment.'/album/'.$album->Folder()->Name;
       Director::redirect($album_URL);
       //die($this->renderWith(array('ImageGalleryPage_album','Page')));
    }

    The URL isn't as pretty, but it fixes the security issue... any thoughts on a better way to do this?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    I would LOVE to find a better way to do this. The die() statement was supposed to be a temporary fix, but ended up sticking because nothing else works. I opted not to use a redirect because people who have only one album are going to want the URL /my-gallery/ to show all their photos and not /my-gallery/album/DefaultAlbum. I know that would get a negative reaction. I wouldn't want it, myself.

    Anyone else? I wonder if that code needs to be moved to the index() action instead of init().

  • jhirm
    Avatar
    Community Member
    21 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    Moving the die() to the index() function solved the security problem for me without the sloppy URL... good call!

    In the init() I now have:

    if(!isset($this->urlParams['Action'])) {
       //SingleAlbumView, handled in index()
    } elseif($this->CurrentAlbum()) {
       $this->includeUI();
    }

    And in the index() is the die():

    public function index() {
       if(!isset($this->urlParams['Action'])) {
          if($this->SingleAlbumView()) {
             die($this->renderWith(array('ImageGalleryPage_album','Page')));
          }
       }
    }

    EDIT: It doesn't get rid of the unconventional use of die() though...

  • Liam
    Avatar
    Community Member
    462 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    So I finally got around to installing this on the latest nestedurls update and ran into an error.

    When I try to add/edit an album I get this error in the lightbox window in the cms admin.

    Fatal error: Call to a member function getErrors() on a non-object in /home/dreamer/public_html/new/sapphire/forms/Form.php on line 543

    I know you don't deal with nestedurls, but any thoughts on this?

    I'm in a jam because it's a very important project to use sub urls, and this photo gallery will be a main page of the site with 100s of albums over the long run. Gah.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    Yeah, I've never used that module. Do you have any instances of a DataObjectManager running successfully? Because the albums interface is just a straight DataObjectManager -- nothing fancy going on. I have a feeling if that is failing for you, then DataObjectManager is not compatible with NestedURLs, which means perhaps ComplexTableField isn't, either, because they both use the same URL handlers.

    Hmm..

  • Liam
    Avatar
    Community Member
    462 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    No, I just installed the whole package and used it out of the box. To be honest, this is the first time working with dataobject_manager and the image gallery. I haven't even taken the time to learn how to use it, I just did a quick upload to test to see if it would work out of the box before spending too much time with it.

    I have a feeling you're right and it's just not compatible. Gah now I really have no idea what to do with this situation...

  • Felicia
    Avatar
    Community Member
    7 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    Hi Uncle Cheese,
    The NextAlbum function is not returning the next album. It is actually returning the last album. Has anyone else seen this problem?
    I just re-installed all the newest versions of DataObjectManager, ImageGallery, & SWFUploadField, but no luck.
    I also tried re-sorting the albums and then placing them back to their original positions with no luck. Please help!

    You can see what I am talking about here: http://66.147.242.166/~pascetti/railings-stairs/album/Cable-Railings

    Thank you for your help!

    *** I got it ***

    *I changed the ImageGalleryPage.php file *
    from this

    * * * *
    public function NextAlbum()
       {
          return $this->adjacentAlbum("next");
       }
    * * * *

    to this

    * * * *
    public function NextAlbum()
       {
          return DataObject::get_one(
             "ImageGalleryAlbum",
             "ImageGalleryPageID = {$this->ID} AND SortOrder > {$this->CurrentAlbum()->SortOrder}",
             false,
             "SortOrder ASC"
          );
          
       }
    * * * *

    It is now working. Yay!

  • Yulia
    Avatar
    Community Member
    26 Posts

    Re: Image Gallery Extension: Testers Needed Link to this post

    Hi!

    i have a question...

    I have many albums on one page, they positioned vertically and description goes on right. the page gets too long because of that. How to do, so after certain amount of albums it will create next page, like in forums here... 1.2.3 so on...?

    another question, i would like to be able to display feature album or images on home page, or most recent ones. It could be just an image, or little slideshow?

    Is there anybody who thought of it, because i am kind of stuck... )

    thank you so much!

    great work

    Yulia

    67014 Views
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.