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

106 lines
4.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.86, maximum-scale=5.0, minimum-scale=0.86">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="stylesheet" href="https://www.gnusocial.rocks//assets/css/reset.css">
<link rel="stylesheet" href="https://www.gnusocial.rocks//assets/css/blog.css">
<link rel='stylesheet' type='text/css' href="https://www.gnusocial.rocks//assets/fonts/opensans/opensans.css"><title>Milestone: Port Media handling from v2 - GNU social V3</title>
</head><body>
<header>
<div class="home-menu menu menu-horizontal menu-fixed">
<a class="menu-heading" href="https://gnusocial.rocks/">
<img src="../assets/img/gnu-social-logo-invert.svg" alt="GNU social">
<b>gnu</b>social
</a>
</div>
<div class="sidebar">
<ul class="menu-list">
<li class="menu-item menu-selected"><a href="index.html" class="menu-link">Blog Index</a></li>
<li class="menu-item"><a href="https://code.gnusocial.rocks/" class="menu-link">Repository</a></li>
<li class="menu-item"><a href="https://coverage.gnusocial.rocks/" class="menu-link">Code Coverage</a></li>
<li class="menu-item"><a href="https://docs.gnusocial.rocks/" class="menu-link">Documentation</a></li>
<li class="menu-item"><a href="https://agile.gnusocial.rocks/" class="menu-link">Wiki</a></li>
<li class="menu-item"><a href="https://kanban.undefinedhackers.net/?controller=BoardViewController&action=readonly&token=d2293e55cabae7cceff9fb496c651328195357d392b9e61a9f229ed6d463" class="menu-link">Roadmap</a></li>
</ul>
</div>
</header>
<div class="content-wrapper">
<div class="content">
</div></div></div>
<div id="template-wrapper"><div class="template-unit">
<!-- entry begin -->
<h3><a class="ablack" href="milestone-port-media-handling-from-v2.html">
Milestone: Port Media handling from v2
</a></h3>
<!-- bashblog_timestamp: #202105031337.42# -->
<div class="subtitle">May 03, 2021 &mdash;
GNU social development team
</div>
<!-- text begin -->
<p><strong><a href="https://agile.gnusocial.rocks/doku.php?id=milestones:attachment_media_embed_handling">>WIKI Milestone entry</a></strong></p>
<p>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.</p>
<p>When a user shares a Link that uses OpenGraph tags or has an OEmbed provider,
the <a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/plugins/Embed">Embed plugin</a> generates a preview for it that may contain a thumbnail.</p>
<p>When a user shares a Link to an image, the <a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/plugins/StoreRemoteMedia">StoreRemoteMedia plugin</a> can fetch the
file and make it available as an attachment, and will generate a thumbnail.</p>
<p>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 if an
EncoderPlugin that supports the mime type is available.</p>
<p>There are two EncoderPlugins implemented:</p>
<ul>
<li><a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/plugins/ImageEncoder">ImageEncoder</a>: Allows to compress, validate, rescale, and sanitize images using VIPS.</li>
<li><a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/plugins/VideoEncoder">VideoEncoder</a>: Allows to rescale gifs using FFMpeg.</li>
</ul>
<p>Another helpful plugin is <a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/plugins/FileQuota">FileQuota</a> which ensures a user stays under the file quota.</p>
<h2>How is the code organised?</h2>
<p>There are various entities related to attachment and thumbnail handling.
The key ones are:</p>
<ul>
<li><a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/src/Entity/Attachment.php">Attachment</a></li>
<li><a href="https://code.undefinedhackers.net/GNUsocial/gnu-social/src/branch/v3/src/Entity/AttachmentThumbnail.php">AttachmentThumbnail</a></li>
</ul>
<p>The plugins are able to act by means of the Events system, as elaborated in the
<a href="https://docs.gnusocial.rocks/developer/storage.html">documentation</a>.</p>
<!-- text end -->
<!-- entry end -->
</div>
</div></div>
<footer class="footer l-box is-center">
This site's source is
<a href="https://code.undefinedhackers.net/GNUsocial/gnusocial.rocks">hosted here</a>.
</footer></body></html>