PhxMediaLibrary.MetadataExtractor.Default (PhxMediaLibrary v0.6.1)

Copy Markdown View Source

Default metadata extractor using the Image library for images.

Extracts dimensions, format, alpha channel presence, and EXIF data from images when the :image library (libvips) is available. For audio and video files, extracts basic format information from the MIME type.

When the :image library is not installed, gracefully falls back to extracting only basic format information from the MIME type and file extension — no error is raised.

Extracted Fields

Images (requires :image)

  • "width" — width in pixels
  • "height" — height in pixels
  • "format" — detected format string (e.g. "jpeg", "png", "webp")
  • "has_alpha" — boolean, whether the image has an alpha channel
  • "exif" — map of EXIF data (when present in the file)

Audio / Video

  • "format" — format derived from MIME subtype (e.g. "mp4", "mp3")

All files

  • "type" — broad type category: "image", "video", "audio", "document", or "other"