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.

Customising the CMS

want to upload as many as Images


Reply

4 Posts   1012 Views

Avatar
leafchild

30 April 2011 at 10:49am Community Member, 41 Posts

I want to create a tab at CMS side that admin can upload as many as image file he wants to
Are there any tutorial I can follow?

How can I set up db?, relationship??

   static $db = array();

static $has_one = array();

static $has_many = array();

also this part

   
function getCMSFields() {
$fields = parent::getCMSFields();

       $fields->addFieldToTab("Root.Content.UploadImage", new ImageField('img', 'Image Upload'));   
         
return $fields;
}
}

Avatar
Willr

30 April 2011 at 7:41pm Forum Moderator, 5511 Posts

You would need to setup a has many relationship. To add an undefined number of images you could try the Has many file manager (http://www.silverstripe.org/has-many-file-manager-module/) not sure if that works with the latest version though. You could also take some ideas from this tutorial - http://deadlytechnology.com/silverstripe/silverstripe-image-gallery/

Avatar
swaiba

3 May 2011 at 11:01pm Forum Moderator, 1796 Posts

This is very nice too!
http://www.leftandmain.com/silverstripe-modules/2010/08/26/uploadify/

Avatar
elgordo

5 May 2011 at 10:56pm Community Member, 70 Posts

hi leafchild

I'm currently working on something that sounds similar, namely a gallery containing photographs (which themselves contain an Image file). I've added a bulk upload tab which is working other than the left hand menu not updating. Still work in progress so please only install on a test site in the first instance

https://github.com/gordonbanderson/Silverstripe-Translatable-Gallery/

Regards

Gordon