Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Replace File in DOM generates File-Object, instead the replaced File-Type

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 1287 Views
  • mtz
    Avatar
    Community Member
    17 Posts

    Replace File in DOM generates File-Object, instead the replaced File-Type Link to this post

    I've checked the new DOM and it works great but i think i found a little Bug.

    When I Replace an Image in the Admin-Pop-Up, I don't get an Image-File-Object back. Instead its a File-Object.

    Now my workaround is an if-condition like

    if(!($img->Attachment() == 'FLV' || $img->Attachment() == 'File')){...}

    did I do something wrong in the DOM installation?

  • UncleCheese
    Avatar
    4085 Posts

    Re: Replace File in DOM generates File-Object, instead the replaced File-Type Link to this post

    You may have found a hole, here.

    First, AssetAdmin has never supported replacement of files, so this is an entirely new feature that the DOM is adding to AssetAdmin. The standard AssetAdmin has a custom uploader that, like DOM, sniffs out image types on upload and saves them accordingly.

    When replacing a file using the FileIFrameField in the popup, we're using a completely different uploader that needs to be fed the file class ahead of time, e.g.:

    $has_one('MyFile' => 'Image');

    new FileIFrameField('MyFile');

    In this case, the field has all the information it needs to feed the controller the necessary metadata about the type of file being uploaded. What you're saying is that the uploader now needs to be smart enough to ignore the classname that is casted and "upgrade" it to an image when necessary. The DOM bulk uploader, being custom code, is smart enough to do that, but with the replace field, we're dealing with a black box, unfortunately.

    Did you in fact get it working? If so show me your changes so I can ratify and add to the module.

    1287 Views
Page: 1
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.