Ticket #5609 (closed enhancement: fixed)

Opened 4 months ago

Last modified 3 months ago

New image uploader

Reported by: tellyworth Assigned to: anonymous
Priority: normal Milestone: 2.5
Component: General Version:
Severity: normal Keywords: has-patch
Cc:

Description

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.

Attachments

loadingAnimation.gif (5.7 kB) - added by tellyworth on 01/09/08 07:26:24.
wp-includes/js/thickbox/loadingAnimation.gif
tb-close.png (506 bytes) - added by tellyworth on 01/09/08 07:26:52.
wp-includes/js/thickbox/tb-close.png
align-center.png (0.6 kB) - added by tellyworth on 01/09/08 07:27:30.
wp-admin/images/align-center.png
align-left.png (0.6 kB) - added by tellyworth on 01/09/08 07:27:58.
wp-admin/images/align-left.png
align-none.png (453 bytes) - added by tellyworth on 01/09/08 07:28:20.
wp-admin/images/align-none.png
align-right.png (0.5 kB) - added by tellyworth on 01/09/08 07:28:45.
wp-admin/images/align-right.png
media-upload-r6577.patch (34.2 kB) - added by tellyworth on 01/09/08 07:51:02.
correct patch file this time

Change History

01/09/08 07:26:24 changed by tellyworth

  • attachment loadingAnimation.gif added.

wp-includes/js/thickbox/loadingAnimation.gif

01/09/08 07:26:52 changed by tellyworth

  • attachment tb-close.png added.

wp-includes/js/thickbox/tb-close.png

01/09/08 07:27:30 changed by tellyworth

  • attachment align-center.png added.

wp-admin/images/align-center.png

01/09/08 07:27:58 changed by tellyworth

  • attachment align-left.png added.

wp-admin/images/align-left.png

01/09/08 07:28:20 changed by tellyworth

  • attachment align-none.png added.

wp-admin/images/align-none.png

01/09/08 07:28:45 changed by tellyworth

  • attachment align-right.png added.

wp-admin/images/align-right.png

01/09/08 07:29:10 changed by tellyworth

Images attached separately as the patch file doesn't include them dammit.

01/09/08 07:51:02 changed by tellyworth

  • attachment media-upload-r6577.patch added.

correct patch file this time

01/09/08 08:14:30 changed by ryan

(In [6579]) New image uploader from tellyworth. see #5609

01/09/08 18:47:50 changed by nbachiyski

If the user has disabled the visual editor from her profile, the Add media: bar isn't shown.

01/09/08 19:03:17 changed by lloydbudd

  • milestone changed from 2.6 to 2.5.

(in reply to: ↑ description ) 01/15/08 04:21:19 changed by janbrasna

Replying to tellyworth:

"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 functions image_send_to_editor() and media_send_to_editor() should be somehow pluggable to allow a) inserting the images in e.g. Textile formatting or with Lightbox and similar additions; b) inserting other media as Flash/FLV in a specific way (think SWFObject, UFO or vPIP); instead of the fixed HTML code for that image/medium.

02/04/08 16:09:02 changed by lloydbudd

Relates to #5722.

02/22/08 22:17:07 changed by andy

  • status changed from new to closed.
  • resolution set to fixed.