gnusocial.rocks/v3/milestone-port-media-handli...

2.1 KiB

Milestone: Port Media handling from v2

WIKI Milestone entry

File Storage in GNU social is used for avatars, for notes containing attachments, and for notes containing links (in which case is an Embed preview). Notes can be created by local users or fetched from remote actors. Filehash is used to reduce file duplication.

When a user shares a Link that uses OpenGraph tags or has an OEmbed provider, the Embed plugin generates a preview for it that may contain a thumbnail.

When a user shares a Link to an image, the StoreRemoteMedia plugin can fetch the file and make it available as an attachment, and will generate a thumbnail.

When an image, video, or other file type is uploaded or retrieved, an Attachment entity is created. When a thumbnail is requested, one is generated.

There are three relevant plugins for attachment handling:

  • ImageEncoder: Allows to compress, validate, rescale, and sanitize images using VIPS.
  • VideoEncoder: Allows to compress, validate, rescale, and sanitize videos using FFMpeg.
  • FileQuota: Ensures a user stays under the file quota.

How is the code organised?

There are various entities related to attachment, and thumbnail handling. The main ones are:

The plugins are able to act by means of the Events system, as elaborated in the documentation.