# Attached v0.1.0 - Table of Contents

File attachments for Ecto schemas

## Pages

- [Attached](readme.md)
- [Changelog](changelog.md)
- [Testing with Phoenix LiveView](testing_with_liveview.md)

## Modules

- [Attached](Attached.md): File attachments for Ecto schemas.
- [Attached.Ecto.CRUD](Attached.Ecto.CRUD.md): Internal, schema-agnostic CRUD helpers used by Attached's context modules.
- [Attached.Ecto.Changeset](Attached.Ecto.Changeset.md): Changeset integration for `attached` fields.
- [Attached.Ecto.Migration](Attached.Ecto.Migration.md): Migrations create and modify the database tables Attached needs to function.
- [Attached.Ecto.Schema](Attached.Ecto.Schema.md): Macros for declaring file attachments on Ecto schemas.
- [Attached.Originals](Attached.Originals.md): Context module for originals.
- [Attached.Originals.ContentType](Attached.Originals.ContentType.md): Detects the real content type of a file by reading its magic bytes.
- [Attached.Originals.ExtractMetadataWorker](Attached.Originals.ExtractMetadataWorker.md): Oban worker that extracts metadata from an original and stores it.
- [Attached.Originals.Original](Attached.Originals.Original.md): Stores metadata about an uploaded file.
- [Attached.Originals.PurgeOrphansWorker](Attached.Originals.PurgeOrphansWorker.md): Oban worker that finds and purges orphaned originals.
- [Attached.Originals.PurgeWorker](Attached.Originals.PurgeWorker.md): Oban worker that asynchronously purges an original and its file from storage.

- [Attached.Originals.Scopes](Attached.Originals.Scopes.md): Composable query scopes for `Attached.Originals.Original`.
- [Attached.Originals.Stats](Attached.Originals.Stats.md): Aggregate statistics over `attached_originals`.
- [Attached.Processors.ImagePreviewers](Attached.Processors.ImagePreviewers.md): Registry and dispatch for image previewers.
- [Attached.Processors.ImagePreviewers.Behaviour](Attached.Processors.ImagePreviewers.Behaviour.md): Behaviour contract for image previewers that generate preview images from non-image files.
- [Attached.Processors.ImagePreviewers.Epub.EpubThumbnailer](Attached.Processors.ImagePreviewers.Epub.EpubThumbnailer.md): Generates a preview image from the cover of an EPUB file using
[`epub-thumbnailer`](https://github.com/marianosimone/epub-thumbnailer)
(Python script).
- [Attached.Processors.ImagePreviewers.Epub.GnomeEpubThumbnailer](Attached.Processors.ImagePreviewers.Epub.GnomeEpubThumbnailer.md): Generates a preview image from the cover of an EPUB file using
`gnome-epub-thumbnailer` (C tool from the GNOME project, also handles MOBI).
- [Attached.Processors.ImagePreviewers.Pdf.Mutool](Attached.Processors.ImagePreviewers.Pdf.Mutool.md): Renders the first page of a PDF as a PNG using `mutool` from
[MuPDF](https://mupdf.com/).

- [Attached.Processors.ImagePreviewers.Pdf.Pdftoppm](Attached.Processors.ImagePreviewers.Pdf.Pdftoppm.md): Renders the first page of a PDF as a PNG using `pdftoppm` from
[poppler](https://poppler.freedesktop.org/).

- [Attached.Processors.ImagePreviewers.Video.FFmpeg](Attached.Processors.ImagePreviewers.Video.FFmpeg.md): Generates a preview image from the first frame of a video file using `ffmpeg`.

- [Attached.Processors.MetadataExtractors](Attached.Processors.MetadataExtractors.md): Registry and dispatch for original metadata extractors.
- [Attached.Processors.MetadataExtractors.Audio.FFmpeg](Attached.Processors.MetadataExtractors.Audio.FFmpeg.md): Extracts duration and bit_rate from audio files using `ffprobe`
(ships with ffmpeg).

- [Attached.Processors.MetadataExtractors.Behaviour](Attached.Processors.MetadataExtractors.Behaviour.md): Behaviour contract for extractors that pull metadata from uploaded files.
- [Attached.Processors.MetadataExtractors.Epub.Bupe](Attached.Processors.MetadataExtractors.Epub.Bupe.md): Extracts EPUB metadata via the [`bupe`](https://hex.pm/packages/bupe)
package. Pure Elixir, no system dependency.
- [Attached.Processors.MetadataExtractors.Image.ImageMagick](Attached.Processors.MetadataExtractors.Image.ImageMagick.md): Extracts width and height from image files using the ImageMagick
`identify` CLI. Swaps dimensions for images rotated 90°/270° via EXIF.

- [Attached.Processors.MetadataExtractors.Image.Vix](Attached.Processors.MetadataExtractors.Image.Vix.md): Extracts width and height from image files using libvips via the
`vix` package. Swaps dimensions for images rotated 90°/270° via EXIF.

- [Attached.Processors.MetadataExtractors.Video.FFmpeg](Attached.Processors.MetadataExtractors.Video.FFmpeg.md): Extracts width, height, duration, angle, display_aspect_ratio, and
audio/video channel flags from video files using `ffprobe`
(ships with ffmpeg).

- [Attached.Processors.Transformers](Attached.Processors.Transformers.md): Registry and dispatch for variant transformers.
- [Attached.Processors.Transformers.Behaviour](Attached.Processors.Transformers.Behaviour.md): Behaviour contract for variant transformers.
- [Attached.Processors.Transformers.Document.Pandoc](Attached.Processors.Transformers.Document.Pandoc.md): Document-to-markdown transformer using [`pandoc`](https://pandoc.org/).
- [Attached.Processors.Transformers.Image.ImageMagick](Attached.Processors.Transformers.Image.ImageMagick.md): Image transformer backed by ImageMagick via the `convert` (v6) or `magick` (v7) CLI.
- [Attached.Processors.Transformers.Image.Vix](Attached.Processors.Transformers.Image.Vix.md): Image transformer backed by libvips via the `vix` package.
- [Attached.Repo](Attached.Repo.md): Resolves the Ecto repo used by Attached.
- [Attached.StorageBackends](Attached.StorageBackends.md): Facade for the configured storage backend.
- [Attached.StorageBackends.Behaviour](Attached.StorageBackends.Behaviour.md): Behaviour contract for storage backends.
- [Attached.StorageBackends.Disk](Attached.StorageBackends.Disk.md): Stores files on the local filesystem.
- [Attached.Test](Attached.Test.md): Test helpers for `attached`.
- [Attached.Variants](Attached.Variants.md): Context module for cached variant derivations of `Attached.Originals.Original`.
- [Attached.Variants.Variant](Attached.Variants.Variant.md): A cached derivation of an `Attached.Originals.Original`.
- [Attached.Variants.VariantTransformWorker](Attached.Variants.VariantTransformWorker.md): Oban worker that pre-processes a variant asynchronously.
- [Attached.Web.Plug](Attached.Web.Plug.md): Plug for serving files from disk storage.
- [Attached.Web.Signer](Attached.Web.Signer.md): Signs and verifies storage keys for secure URL generation.
- [Attached.Web.UrlHelpers](Attached.Web.UrlHelpers.md): Template helpers for rendering attachment URLs.

- Exceptions
  - [Attached.Variants.NoTransformerError](Attached.Variants.NoTransformerError.md): Raised when no transformer (direct or via the image previewer fallback) is
available to produce a variant for the given content-type pair.

## Mix Tasks

- [mix attached.gen.migration](Mix.Tasks.Attached.Gen.Migration.md): Generates an Ecto migration for an `attached` field on a schema.
- [mix attached.install](Mix.Tasks.Attached.Install.md): Generates an Ecto migration that creates the `attached_originals` and
`attached_variants` tables.

