If I could +1000 that I would. Exactly what I'm looking for

Presumably write my own and register with ShortcodeParser?

Just because my problems are never straightforward - is there a way to override the default [image] shortcode? I need to get absolute image URLs but the default one calls File::getURL() rather than File::getAbsoluteURL() and doesn't appear to be configurable.

Late to the party, but for adding file uploads as Assets in the CMS (from the frontend / AJAX), I came up with this a few weeks ago:

  1. use SilverStripe\Control\Controller;
  2. use SilverStripe\Control\HTTPRequest;
  3. use SilverStripe\Assets\Image;
  4. use SilverStripe\Assets\Upload;
  5. use SilverStripe\AssetAdmin\Controller\AssetAdmin;
  6.  
  7. class MyVeryOwnController extends Controller
  8. {
  9. public function myveryownaction(HTTPRequest $request)
  10. {
  11.  
  12. $data = $request->postVars();
  13.  
  14. if (isset($data['photo']) && is_array($data['photo'])) {
  15. $foldername = "a-folder-in-assets";
  16.  
  17. $file = new Image;
  18. $upload = new Upload;
  19. $upload->loadIntoFile($data['photo'], $file, $foldername);
  20. if ($upload->isError()) {
  21. return $this->httpError('400', 'File invalid');
  22. }
  23. $assetadmin = AssetAdmin::singleton();
  24. $assetadmin->generateThumbnails($upload->getFile(), true);
  25.  
  26. doSomethingWith($upload->getFile()); // Do what you need to with the uploaded file
  27. }
  28.  
  29. if (isset($data['photo']) && !is_array($data['photo'])) {
  30. return $this->httpError('400', 'File invalid');
  31. }
  32. }
  33. }
(edited)

That has just explained the extension mechanism in a nutshell for me, at least.

Plenty of things are configurable if you can only find the configuration!