On Mon, Dec 27, 2010 at 8:52 AM, Neil Kandalgaonkar <neilk(a)wikimedia.org>wrote;wrote:
On 12/27/10 7:47 AM, Guillaume Paumier wrote:
Neat :)
Would it require a lot of work to also include these thumbnail previews
to the file selection step of Special:UploadWizard?
Nope. It's designed explicitly so this should be easy. There are
"frontend" and "backend" parts to every upload, that can be mixed
and
matched. I would be happy to help anyone who is interested.
\o/ :D
If nobody else gets to it I'll give it a whack in a few days.
The actual previewing doesn't tie too specifically into anything in the
current upload page, so it should work well to split out the code that does
the [check API availability, set up event handler on the input, handle the
slurping in of the file, create a thumbnail div] as its own module which can
be easily used on any form.
Possibly do that as a jquery extension so can do something like:
$('#mw-htmlform-source').parent().prepend('<div
id="mw-thumbnail-area"></div>');
$('#wpFileInput').previewUploadThumbnail('#mw-thumbnail-area');
(Extending forms to also support HTML 5 drag-n-drop would be a bit harder
because it complicates the actual form submission, but the preview-y part
could hook in similarly because file transfer there is also based on
FileAPI.)
-- brion