PhoenixKitDocumentCreator.Media (PhoenixKitDocumentCreator v0.4.4)

Copy Markdown View Source

Façade over PhoenixKit.Modules.Storage for the image-substitution pipeline.

Resolves a media_id (file UUID) to a public URL and stored pixel dimensions. The backing module is injectable via:

config :phoenix_kit_document_creator, :media_module, MyStubStorage

In production the default is PhoenixKit.Modules.Storage.

Summary

Functions

Resolves a media UUID to its public URI and stored pixel dimensions.

Functions

get_url_and_dimensions(media_id)

@spec get_url_and_dimensions(String.t()) ::
  {:ok,
   %{uri: String.t(), width_px: integer() | nil, height_px: integer() | nil}}
  | {:error, :image_not_found | :image_url_not_public}

Resolves a media UUID to its public URI and stored pixel dimensions.

Returns:

  • {:ok, %{uri: String.t(), width_px: integer() | nil, height_px: integer() | nil}}

  • {:error, :image_not_found} — UUID has no matching file record
  • {:error, :image_url_not_public} — file exists but has no resolvable public URL