Image.Plug.Admin (image_plug v0.1.0)

Copy Markdown View Source

HTTP admin surface for variant CRUD.

Mount this plug under whatever path your host exposes (the admin routes are intentionally relative — no baked-in prefix).

MethodPathAction
GET/List all variants.
GET/:nameFetch one variant.
POST/Create a variant. 409 on name conflict.
PUT/:nameUpsert a variant.
PATCH/:namePartial update of an existing variant.
DELETE/:nameDelete a variant.

Request bodies use the canonical variant JSON shape:

{
  "name": "thumbnail",
  "options": "width=200,height=200,fit=cover,format=webp",
  "metadata": {"description": "card thumbnail"},
  "never_require_signed_urls": false
}

options is a provider-specific options string parsed by the configured provider (Cloudflare by default).

Configuration

  • :provider — module used to parse the options string. Defaults to Image.Plug.Provider.Cloudflare.

  • :variant_store{module, options} tuple identifying the variant store. Defaults to {Image.Plug.VariantStore.ETS, []}.

Authentication

This plug does not authenticate or authorise requests. Wrap it in your host's auth pipeline (e.g. a :basic_auth plug or a Phoenix :require_admin pipeline) before exposing it publicly.