Jump to:

23491 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Image subfolder

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

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

Page: 1 2
Go to End
Author Topic: 3314 Views
  • theAlien
    Avatar
    Community Member
    131 Posts

    Re: Image subfolder Link to this post

    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
  • damoar
    Avatar
    Community Member
    1 Post

    Re: Image subfolder Link to this post

    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');

    3314 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.