Astral.Image (Astral v0.1.4)

Copy Markdown View Source

Build-time optimized images for Astral pages, layouts, and Markdown content.

Calls to get_image/1 and get_picture/1 normalize local source images, compute hashed output paths, register transforms for the post-render image builder, and return render-ready image data.

Summary

Functions

Return an optimized image result for the current render.

Return an optimized image result for a site.

Return fallback and source-set results for a responsive picture.

Return fallback and source-set results for a responsive picture in a site.

Return true when a path looks like a supported local image.

Return source metadata for an image in the current render context.

Return source metadata for an image in a site.

Functions

get_image(opts)

@spec get_image(keyword() | map()) :: Astral.Image.Transform.t()

Return an optimized image result for the current render.

get_image(site, opts)

@spec get_image(Astral.Site.t(), keyword() | map()) :: Astral.Image.Transform.t()

Return an optimized image result for a site.

get_picture(opts)

@spec get_picture(keyword() | map()) :: %{
  fallback: Astral.Image.Transform.t(),
  sources: list()
}

Return fallback and source-set results for a responsive picture.

get_picture(site, opts)

@spec get_picture(Astral.Site.t(), keyword() | map()) :: %{
  fallback: Astral.Image.Transform.t(),
  sources: list()
}

Return fallback and source-set results for a responsive picture in a site.

image?(path)

@spec image?(String.t()) :: boolean()

Return true when a path looks like a supported local image.

metadata(source)

Return source metadata for an image in the current render context.

metadata(site, source)

Return source metadata for an image in a site.