[wp-trac] [WordPress Trac] #5609: New image uploader
WordPress Trac
wp-trac at lists.automattic.com
Wed Jan 9 07:22:46 GMT 2008
#5609: New image uploader
-------------------------+--------------------------------------------------
Reporter: tellyworth | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.6
Component: General | Version:
Severity: normal | Keywords: has-patch
-------------------------+--------------------------------------------------
Here's a patch for a new image uploader. The visual design is to spec for
the new UI. It's one portion of the new media library popup for the post
edit page.
Uploading and sending to the editor happens in a single step: clicking the
Add Image button does the upload, inserts the attachment post, sends the
img src html to the editor, and closes the popup.
The popup is handled by Thickbox, with the contents in an iframe. I made
some wp-specific changes to the Thickbox js: $() changed to jQuery();
addLoadEvent() instead of read() (thanks mdawaffe); and the close link
changed to a [x] png as per the design spec.
I've attempted to split the code into functions that are specific to the
image uploader (functions named image_*()) and functions that will be
useful for other media uploaders (video, audio) - though they'll probably
need some tweaking. There's a trivial hook for other media uploaders in
the form of the media_upload_{$type} action in wp-admin/media-upload.php.
Also yet to be implemented are the other tabs on the image uploader
("Media Library" and "Flickr"). They're just hard-coded for now. I
considered a flexible tab system like the old $wp_upload_tabs thing, but I
think it'd be better to go with something simpler instead, like a simple
action.
All the old uploader code is still in place for now, but should be removed
once this is solid enough.
It would be possible to do this using Ajax instead of an iframe but the
iframe approach seems to offer a better fallback and more reusable code.
--
Ticket URL: <http://trac.wordpress.org/ticket/5609>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list