7912 Posts in 1355 Topics by 930 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, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 1171 Views |
-
Replace File in DOM generates File-Object, instead the replaced File-Type

18 September 2009 at 10:24pm
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?
-
Re: Replace File in DOM generates File-Object, instead the replaced File-Type

18 September 2009 at 11:48pm
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.
| 1171 Views | ||
|
Page:
1
|
Go to Top |

