[wp-hackers] New uploader from #5722 in 
skeltoac at gmail.com
Mon Jan 28 21:29:50 GMT 2008
Since http://trac.wordpress.org/changeset/6659 we have a new uploader
in trunk. It will need some attention before 2.5 is released and I
think it's best if some people besides Alex and myself can hack it.
Thus I am posting the remainder of the todo list and ideas that we
didn't complete so that you may familiarize yourself with the code and
contribute something to its completion if you are interested.
First, a bit of explanation. The picture uploader accepts a single
image file, uploads it with a progress bar, attaches it to the post,
pre-fills some info from the file's metadata into the attachment
record, and gives the user a form for editing that record and
inserting the image into the post. The multimedia uploader lets you
select multiple files of multiple types (double entendre, heh) and
uploads them one at a time, shows individual progress bars, and lets
you start editing the titles/descriptions/taxonomies as soon as the
first file is done. It also lets you edit all of the attachments on
any post after-the-fact, including attachments uploaded using earlier
WordPress versions. Finally, the multimedia uploader will send the
entire set of attachments to the post as a little macro (shortcode)
that works like the embed codes on WordPress.com and an API is
included for plugging in new macros.
Error handling: the single uploader is pretty solid but needs testing.
The multi uploader needs testing and error display work. The basic
idea is to show errors without changing the work flow. Errors may be
shown on individual progress bars or description forms if appropriate.
Otherwise they should appear at the top and disappear when
Attachment sorting: the queries for displaying attachments already
have "ORDER BY menu_order ASC, ID ASC" but there is currently no UI
for sorting the attachments. I tried to make the bars sortable with
the included jQuery library but something about the positioning made
it all go haywire. I hope somebody can add sorting to the multimedia
uploader without creating additional UI elements.
Attachment template tags: we need functions to find adjacent
attachments (having same post_parent, using ORDER BY as above) and
displaying those much like previous/next post links. Also, support for
taxonomies is included in the multimedia uploader and it needs to be
added to the default template. It should at least display the taxonomy
title and list the terms.
More about taxonomies: there is an example at the bottom of media.php.
Basically, one line of code is all you need in order to add an
attachment taxonomy; it will automatically be added to the multimedia
uploader (thanks to the excellent new taxonomy API). What's missing is
a template tag for displaying plugged-in taxonomies. It should have
options for formatting (paragraph or list style, before/after tags,
etc.) and be added to the attachment template. These taxonomies will
need to be links and work with rewrite for pretty URLs, too. This is
intended to make it easy to add stuff like people tagging as seen here
http://ma.tt/photos/log/1-24-2007 and here
http://ma.tt/photos/person/andy-skelton (Matt's severely hacked
MIME types: the multimedia uploader is meant to accept all allowed
file types. We need thumbnail representations for more of the default
types. I added an audio thumbnail to the default theme a long time ago
and the attachment thumbnail function already looks for the right
thumbnail for the media type in the theme dir. That function needs to
fall back to core thumbnails for important types and such thumbnails
must be created, as well as a catch-all thumbnail. This way, themes
can supply their own MIME-based thumbnails if they want to. The idea
is to allow all attachments to be displayed in a thumbnail grid. There
should be thumbs for pdf, zip, txt, and probably a few others. (The
MIME type of each attachment is in the posts table, iirc.)
Gallery templates: Because we made it so easy to upload and describe
many images at once, we expect the multimedia uploader to make
WordPress a more attractive choice for people who otherwise might
install Gallery or use different web services. These people are going
to want their galleries to look a certain way. The included macro can
be overloaded by themes or plugins. There should also be gallery
template file support, along with all the rewrite stuff to make it
Backward compatibility/progressive features: we used Flash because it
let us do cool things like progress bars and multiple file selections.
With JS but no Flash, you should still be able to upload files and
have them added to the multimedia upload list without reloading the
page. With no JS, the uploader window cannot be opened so it doesn't
need to work without JS. I think we should keep the iframe uploader
around in a noscript tag for that case. All of this needs verification
There are probably more things I've forgotten and I hope Alex can
supply his list as well.
You do not need to ask anyone for permission to work on these things.
Form teams if you like, ask the list for opinions, post demo URLs, and
upload patches to trac, but I have other projects and I don't expect
to have time to work on this one. I will be happy to answer questions
about any code I might have written.
More information about the wp-hackers