Astral.Image.Source (Astral v0.2.0)

Copy Markdown View Source

A local image source resolved from content metadata.

Collection schemas use this struct for field :cover, :image. It carries the user-facing source string plus the resolved file path and metadata needed by image components.

Summary

Functions

Resolve a local image source against a base file or directory.

Types

t()

@type t() :: %Astral.Image.Source{
  format: Astral.Image.Format.t(),
  height: pos_integer(),
  path: String.t(),
  src: String.t(),
  width: pos_integer()
}

Functions

resolve(src, opts \\ [])

@spec resolve(
  String.t(),
  keyword()
) :: {:ok, t()} | {:error, term()}

Resolve a local image source against a base file or directory.