Image.Plug.SourceResolver.Composite (image_plug v0.1.0)

Copy Markdown View Source

Source resolver that dispatches by Image.Plug.Source.kind to a configured set of per-kind resolvers.

This is the resolver most hosts will use: a single Image.Plug configuration handles every URL form the Cloudflare provider can produce (file paths, absolute URLs, hosted asset ids).

Configuration

Each per-kind sub-resolver is configured as a keyword under its kind name. Sub-resolver options are passed through verbatim.

Example:

{Image.Plug.SourceResolver.Composite,
 file:   [root: "priv/static/uploads"],
 http:   [allowed_hosts: ["assets.example.com"]],
 hosted: {MyApp.AssetResolver, table: :my_assets}}