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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Gallery for Silverstripe


Go to End


4 Posts   1484 Views

Avatar
Sue

Community Member, 26 Posts

15 July 2011 at 3:47am

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

15 July 2011 at 4:41am

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

Avatar
Sue

Community Member, 26 Posts

15 July 2011 at 4:52am

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

Avatar
greenpea

Community Member, 19 Posts

15 August 2011 at 12:59am

Edited: 15/08/2011 8:28pm

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/