Attachments
StatusNet 0.8 and later support uploading files as attachments to notices.
Contents |
The user experience
| When composing a notice, click the paper clip icon to add an attachment... | |
| This'll launch a file picker dialog. Pick the image file you wish to attach. | |
| The selected file is now listed below the notice composition area -- you're ready to send!
If you change your mind, you can remove the file by clicking the "x" next to it before you send the message. |
|
| When you send the message, the attachment is uploaded to the server, and a shortened URL to it is appended to your notice text.
Within StatusNet the attachment link will be marked with a paper clip icon to indicate that it's a special attachment; it'll be just a plain link when bridged to most other networks such as Twitter. The Facebook bridge will show a thumbnail. |
StatusNet: |
| When someone clicks on the attachment link within the StatusNet web interface, a lightbox will pop up with the image and a full URL which can be cut-and-pasted.
The lightbox is built via oEmbed, and in theory allows nice similar view embedding for remote links to other sites as well, where supported. |
Under the hood
Attachment processing currently can happen in two code paths:
- web UI, through NewnoticeAction
- mail channel, through MailerDaemon
Per-user quotas are enforced at upload time, via checks in File::isRespectsQuota().
- file_quota (max size per file) default 5,000,000 bytes
- user_quota (lifetime max per user) default 50,000,000 bytes
- This sounds a little harsh... how could a user expand their quota over time? --brion 17:24, 11 October 2009 (UTC)
- monthly_quota (monthly max per user) default 15,000,000 bytes
Uploaded files have their content-types checked via the PEAR::Mime_Type module (which uses the file command as its backing -- configurable via $config['attachments']['file'] to change from default /usr/bin/file). Only files matching whitelisted MIME types are allowed through.
Types allowed by default:
- image/png
- image/jpeg
- image/gif
- image/svg+xml
- audio/mpeg
- audio/x-speex
- application/ogg
- application/pdf
- application/vnd.oasis.opendocument.text
- application/vnd.oasis.opendocument.text-template
- application/vnd.oasis.opendocument.graphics
- application/vnd.oasis.opendocument.graphics-template
- application/vnd.oasis.opendocument.presentation
- application/vnd.oasis.opendocument.presentation-template
- application/vnd.oasis.opendocument.spreadsheet
- application/vnd.oasis.opendocument.spreadsheet-template
- application/vnd.oasis.opendocument.chart
- application/vnd.oasis.opendocument.chart-template
- application/vnd.oasis.opendocument.image
- application/vnd.oasis.opendocument.image-template
- application/vnd.oasis.opendocument.formula
- application/vnd.oasis.opendocument.formula-template
- application/vnd.oasis.opendocument.text-master
- application/vnd.oasis.opendocument.text-web
- application/x-zip
- application/zip
- text/plain
- video/mpeg
- video/mp4
- video/quicktime
- video/mpeg
Troubleshooting
Client problems
Attachments don't get properly added to the notice text if you have disabled automatic URL shortening in your account preferences.
Buggage with Internet Explorer has been reported.
- http://status.net/trac/ticket/1826 (possibly fixed?)
- http://status.net/trac/ticket/1831 - Attachment not cleared from form after sending a notice in IE 8
Server problems
Common problems with uploading:
- Make sure the
filesubdirectory is writable by the user the web server runs as (the installer should check for this) - Check php.ini for PHP configuration settings...
-
file_uploads(should be 'On') -
upload_tmp_dir(system default temp dir or one that exists and is writable to web server) -
upload_max_filesize(default 2M) -
post_max_size(default 8M) -
memory_limit(default unlimited) -
safe_modeprobably needs to be off
-
Known bugs...
- http://status.net/trac/ticket/1787 - Attach File Fails (missing /usr/bin/file)
- http://status.net/trac/ticket/1739 - Not uploading attachments
- http://identi.ca/conversation/17247553#notice-17254885 - Someone should mention somewhere that 'other media types' need to be enabled before uploading anything (apologies for the bad formatting, I'm new here).
Feature reqs
- http://status.net/trac/ticket/1765 - Attachment preview for oEmbed-enabled URIs
- http://status.net/trac/ticket/62 - License per attachment
- http://status.net/trac/ticket/1918 - HTML 5 drag-and-drop upload support