Image.Plug.Provider.Cloudflare (image_plug v0.1.0)

Copy Markdown View Source

Cloudflare Images URL provider.

Wires Image.Plug.Provider.Cloudflare.URL (URL-shape recognition) and Image.Plug.Provider.Cloudflare.Options (option parsing) into the Image.Plug.Provider behaviour.

Options

  • :mount — string path prefix the plug is mounted under. Defaults to "". See Image.Plug.Provider.Cloudflare.URL.

  • :hosted_account_hash — when set, also recognises the hosted-image delivery form at /<this-hash>/<image-id>/<variant-or-options>.

  • :strict? — if true (default), unknown option keys produce an :unknown_option error. If false, unknown keys are logged and ignored.

  • :variants_enabled? — defaults to true. When false, a hosted URL whose tail looks like a variant name produces a :variant_not_found error instead of returning a :variant result.

URL forms recognised

  • /cdn-cgi/image/<options>/<absolute-path>

  • /cdn-cgi/image/<options>/<https-url>

  • /<account_hash>/<image-id>/<variant-or-options> (when :hosted_account_hash is configured)