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


Go to End
Reply


4 Posts   1089 Views

Avatar
leafchild

Community Member, 41 Posts

30 April 2011 at 10:49am

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

Forum Moderator, 5514 Posts

30 April 2011 at 7:41pm

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

Forum Moderator, 1809 Posts

3 May 2011 at 11:01pm

Avatar
elgordo

Community Member, 70 Posts

5 May 2011 at 10:56pm

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