Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Gallery for Silverstripe

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: 982 Views
  • Sue
    Avatar
    Community Member
    26 Posts

    Gallery for Silverstripe Link to this post

    I inherited a silverstripe website and am totally new to it. I was able to get the site up and running from the DVD provided by the client. Now I need to add a photo gallery. DataObjectManager is installed. I tried installing ImageGallery and did a dev/build before and after. I was really hopeful because all looked like it worked, but when I tried to add a new gallery page in the admin, the adding new gallery page appeared with a spinning icon and all of it stayed yellow orange, and kept spinning. It never did create a page and I had to back date my site to recoup the original site and database. I have been reading the posts on the forum and it appears there are a lot of problems with ImageGallery/ My questions, is it possible without a lot of research and reprogramming to get ImageGallery working or is there another Gallery programing that does work with little aggravation. I appreciate any insight to this as I need to get the gallery up without hours and hours of work.

    thanks!
    Sue Young

    Silverstripe is version 2.3.7

  • UncleCheese
    Avatar
    4085 Posts

    Re: Gallery for Silverstripe Link to this post

    Honestly, the ImageGallery module is just a turnkey solution for a gallery made with ImageDataObjectManager. If you're at all skilled with coding, you can just build one custom with very little effort.

    GalleryPage.php

    static $has_many = array (
    'GalleryImages' => 'GalleryImage'
    );

    public function getCMSFields() {
    $f = parent::getCMSFields();
    $f->addFieldToTab("Root.Content.Images", new ImageDataObjectManager($this,'GalleryImages','GalleryImage','Image'));
    return $f;
    }

    GalleryImage.php

    static $db = array (
    'Caption' => 'Text'
    );

    static $has_one = array (
    'Image' => 'Image'
    );

    public function getCMSFields() {
    return new FieldSet (
    new ImageUploadField('Image'),
    new TextareaField('Caption')
    );
    }

    GalleryPage.ss

    <% control GalleryImages %>
    $Image.CroppedImage(100,100)
    <a href="<% control Image %><% control SetWidth(800) %>$URL<% end_control %><% end_control %>view larger</a>
    <% end_control %>

    _config.php
    SortableDataObject::add_sortable_class('GalleryImage');

    That's pretty much it. Can't promise it's free of syntax errors, but you get the gist..

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • Sue
    Avatar
    Community Member
    26 Posts

    Re: Gallery for Silverstripe Link to this post

    I know only a little of programming. And nothing at all about SilverStripe (was happy I could get the site up and running) I appreciate your response very much, but where would this code go and how would it work?

    Meanwhile does anyone else know of a solution?

    Sue

  • greenpea
    Avatar
    Community Member
    19 Posts

    Re: Gallery for Silverstripe Link to this post

    Have you tried installing the uploadify module? Try installing it if you haven't - it worked for me.

    http://www.silverstripe.org/uploadify-module/
    http://www.leftandmain.com/silverstripe-tutorials/2010/08/30/using-uploadify-in-frontend-forms/

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