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.

Customising the CMS /

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

want to upload as many as Images


Go to End


4 Posts   1561 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, 5523 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, 1899 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