Reusing the Media Upload kit in a plugin
|Reported by:||simonwheatley||Owned by:|
I'm keen to reuse the Media Upload overlay (i.e. the thickboxed iframe from the edit post/page screens) when I need to upload files for a plugin. It seems crazy to be reimplementing file upload and image resizing code when it's built into WordPress core. However the hooks aren't there currently.
The attached proof of concept plugin "rmu-poc.php" shows that it is possible to write a plugin which pops up the upload overlay (install it and go to the edit category screen), but a number of issues prevent it being useful:
The form is setup to be called in the context of the edit post/page screen, for example the JS callback expects to find a function send_to_editor which will accept it's HTML.
It would be handy to insert some additional post fields to be sent when the SWF Uploader uploads files, so the plugin can detect that it should be doing something with that upload.
The get_media_item function needs a way to customise the button label. Currently the proof of concept does a very ugly hack on a translation filter.
Before I get over excited, is anyone up for these changes? If I started cutting some patches, would they be considered?
Change History (26)
comment:14 scribu — 4 years ago
- Keywords has-patch added
- Milestone changed from Future Release to 3.1
- Type changed from feature request to enhancement