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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Image subfolder


Go to End


10 Posts   5129 Views

Avatar
theAlien

Community Member, 131 Posts

8 January 2010 at 2:16pm

Edited: 28/01/2010 9:17am

As pointed out here, due to a bug it is not possible to upload images to a custom folder with ImageField.
This will be fixed in SS2.4.0. But SS2.4.0 is just in it's first alpha-fase, so it is likely we have to be patient before the stable can be downloaded.

That's why I created this module. It is heavily based on http://svn.silverstripe.com/open/phpinstaller/branches/2.4/ Revision 96438

To use this module:
- install the module in the normal way
- call either NewImageField or NewIFrameField like you're calling any other fieldtype
- the attributes are the same as for ImageField and IFrameField in SS2.3.x

This module is useful as long as you're using SS2.3.x
Though it shouldn't break, I'd strongly recommend you to rewrite your code in order to use the built-in IFrameField and ImageField as soon as you start updating your productionsite(s) to SS2.4.

EDIT: grmbl it seems the module won't be working in DOM. So if you're uploading through (F/I)DOM, you have to stick to the old FileIFrameField or ImageField with all their flaws :-(

Attached Files
Avatar
damoar

Community Member, 1 Post

7 July 2010 at 8:28pm

Thanks theAlien for the Module. It helped me a lot.
But I had difficulties choosing existing files from a subfolder in assets:

sapphire\forms\TreeDropdownField.php line 90: Can't find database record Image with ID = xxx

Changing the last Argument to 'File' in line 130 in NewIFrameField.php solved the problem:


$fileSources["existing//$selectFile"] = new TreeDropdownField('ExistingFile', '', 'File');

Go to Top