Attached.Processors.ImagePreviewers (Attached v0.1.0)

Copy Markdown View Source

Registry and dispatch for image previewers.

An image previewer accepts a content type and a system tool, checks at runtime whether the tool is available, and renders a preview image.

Each module wraps exactly one CLI tool. Multiple modules can target the same content type — the dispatcher picks the first one whose binary is installed, so installing any of them is enough.

Ships with:

Configuration

Image previewers are tried in order. Override the list to add your own or reorder fallbacks:

config :attached, image_previewers: [
  Attached.Processors.ImagePreviewers.Video.FFmpeg,
  Attached.Processors.ImagePreviewers.Pdf.Mutool,
  Attached.Processors.ImagePreviewers.Pdf.Pdftoppm,
  MyApp.ImagePreviewers.Office
]

Summary

Functions

Returns the first image previewer that accepts the given content type and whose runtime dependencies are available. nil if none match.

Returns all configured image previewers (regardless of availability).

Functions

find_for(content_type)

Returns the first image previewer that accepts the given content type and whose runtime dependencies are available. nil if none match.

list()

Returns all configured image previewers (regardless of availability).