Attachment tech
From StatusNet
Contents |
[edit] File uploads
[edit] Multiple selection
- Check the extensions to standard, some current browsers support this already...
- Flash can do this
[edit] Thumbnail after upload
- Can submit the file in an iframe before we finalize the message...
- FileAPI can possibly get at the data locally, could thumbnail via canvas -- check?
- Flash can possibly get at the data locally -- check?
[edit] Progress meter
- Flash can do this
- non-flash methods should exist, but look awkward
[edit] Webcam access
For photo and video uploads recorded straight from the local computer...
- Flash can do this.
- Is there a ready-made implementation that can be dropped in?
- HTML 5 Capture API - http://www.w3.org/TR/capture-api/
- are there any implementations yet?
- extends <input type="file"> to allow recording from local as well
- can specify a preference for a particular type of recording source
[edit] Drag and drop
Enhanced support for accepting images, files, or links drag-n-dropped from other windows or apps, where supported...
http://dev.w3.org/html5/spec/dnd.html
Some notes:
- http://ln.hixie.ch/?start=1115899732&count=1
- http://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html#c12552
The HTML5 DND spec is based on IE's existing implementation, so this may even work in current IE. :)
- We can receive data from outside the application!
- gmail allows drag-n-dropping file attachments using this system, it should do pretty well
- they create a specially marked drop-area during drag -- nice as it aids in discovery of the feature
- We need to override a few events to accept drop data
- Data format:
- dragged data may contain 1 or more items
- each item is labeled with a MIME type
- Raw data types:
- Unicode string
- binary file with a Unicode string filename
- Note that full file data isn't available until the drop event -- at drag time we only know there's something coming.
jQuery plugin: http://plugins.jquery.com/project/jquery-filedrop
[edit] Remote attachment metadata
We get information about remotely linked attachments via oEmbed:
- hosts with known oEmbed endpoints are queried directly based on the URL:
- flickr
- yfrog
- hosts with known alternate query methods are queried that way:
- twitpic
- pages providing oEmbed discovery data are queried directly based on info retrieved from the linked page:
- YouTube
- StatusNet sites
- other pages fall back to ooHembed.com's oEmbed proxy
Possible additional methods:
- manual extraction of HTML title, initial text, and a big-looking image (like Facebook does)
- fetch data provided in specific meta tags
- such as the ones Facebook recognizes itself
[edit] Multiple file selection
https://developer.mozilla.org/en/DOM/Input.multiple
Adding "multiple" attribute on the <input type="file"> should enable selection of multiple files.
PHP side:
- will this be natively supported on PHP side?
- looks like specifying an element name with an array will make PHP happy enough to accept the multiple files [1]
- do we need to change our code on the PHP side?
- will need to change a little bit at least to accept the alternate multi-file param
- should make sure the code accepts both single and multi entries -- existing api and things piggybacking on web ui api might be assuming the field name
JS side:
- FileList interface from the FileAPI can provide access to multiple files that have been selected -- is same interface used for drag-and-drop file data transfer, from what I can understand.
- Could use common code to process them and submit the file(s) via XHR