Jump to:

10993 Posts in 2727 Topics by 1818 members

All other Modules

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

Discuss all other Modules here.

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

Go to End
Author Topic: 77264 Views
  • UncleCheese
    Avatar
    4085 Posts

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

    If I were you, I would first extend the ImageGalleryPage class, and have it relate to another extended ImageGalleryItem class. Your ImageGalleryItem subclass could have a Thumbnail field.

    class MyGallery extends ImageGalleryPage
    {
    protected $itemClass = "MyImageGalleryItem";

    static $has_many = array (
    'MyImageGalleryItems' => 'MyImageGalleryItem'
    );
    }

    class MyImageGalleryItem extends ImageGalleryItem
    {
    static $has_one = array ('Thumbnail' => 'Image');

    public function getCMSFields_forPopup()
    {
    $f = parent::getCMSFields_forPopup();
    $f->push(new ImageField('Thumbnail'));
    return $f;
    }
    }

    I'll make an update to the core to use the dynamic $itemClass property in the GalleryItems() control.

    Then you just need to update your template to use the new thumbnail image.

  • Anonymous user
    Avatar
    Community Member
    6 Posts

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

    Good evening UncleCheese,

    I'm using SS 2.3.1 with your current SVN trunk and cannot select an album image from a sub subdirectory of the file store. The sub subdirectory icon has no "+" and is not expandable. Would you please fix that bug?

    Thanks in advance!

    P.S. Good job anyway!

  • micahsheets
    Avatar
    Community Member
    164 Posts

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

    Thanks, I think I understand how that will work. I can then do something similar to force the image_gallery to also load the uploaded image instead of the resampled one. I find that if I put a size in for the original it will make smaller images larger and so they won't look very good. I don't wan't to have to always upload images that are the size that is defined as the original size in the CMS.

    I will like having a gallery that has my sized and cropped thumbnails and full size images.

    Thanks again for your help. I am learning a lot about SS and OOP at the same time.

  • UncleCheese
    Avatar
    4085 Posts

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

    Sounds like a bug with the TreeDropdownField to me. Have you checked open.silverstripe.com?

  • micahsheets
    Avatar
    Community Member
    164 Posts

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

    Regarding the custom Thumbnail upload. I have implemented a solution based on your recommendation and now my gallery images have an extra image upload area which is good. When I upload a thumbnail image I can see the line get added to the database table where it should however I am missing something in my code as the popup does not display the thumbnail as the normal upload area does. Also I am not sure how to tell my template to get the uploaded thumbnail. I can see that in the template it uses $ThumbnailURL to get it but what would I use to get the new one?

    Also is it possible to get the $ViewLink to display the path to the original image instead of the resized one?

  • UncleCheese
    Avatar
    4085 Posts

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

    You're going to need to modify the template a bit to get it to work. Create MyImageGalleryPage.ss, copy the template over from the image_gallery module, and customize it. To get the thumbnail all you should have to do in your GalleryItems control is $Thumbnail - assuming that's the name of the field on your ImageGalleryItem subclass.

    As far as all the UI stuff, that's entirely up to you. But use the OO design pattern to overload the methods in ImageGalleryPage to customize the variables you need. I personally wouldn't bother with ViewLink if you're doing a custom template anyway. That stuff is just in there to support the UI plugins.

  • Anonymous user
    Avatar
    Community Member
    6 Posts

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

    Hello again,

    I've found out that there's no problem with the TreeDropdownField. After importing images from an existing folder to a new album, all images from the original folder moved to a folder named "image-gallery/<album name>". The original folder still exists, but contains only a sub folder named "_resampled". The destination folder now contains the images and also a sub folder "_resampled".

    Is this a bug or the right behaviour?

  • UncleCheese
    Avatar
    4085 Posts

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

    That's correct. All the resampled images go in the child folder _resampled. That's a Silverstripe convention.

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