Attachments

From StatusNet
Revision as of 07:03, 16 April 2010 by Stéphane Thibault (Talk | contribs)
Jump to: navigation, search

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... Attachment-pre.png
This'll launch a file picker dialog. Pick the image file you wish to attach. Attachment-picker.png
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.

Attachment-send.png
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:

Attachment-notice.png
Twitter:
Attachment-twitter.png
Facebook:
Attachment-facebook.png

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.

Attachment-lightbox.png

Under the hood

Attachment processing currently can happen in two code paths:

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.

Server problems

Common problems with uploading:

  • Make sure the file subdirectory 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_mode probably needs to be off

Known bugs...

Feature reqs

Personal tools
Namespaces
Variants
Actions
Navigation
Status.net
Toolbox