# `Image.Plug.Provider.Cloudflare.Options`
[🔗](https://github.com/elixir-image/image_plug/blob/v0.1.0/lib/image/plug/provider/cloudflare/options.ex#L1)

Parses the comma-separated `<options>` segment of a Cloudflare
Images URL into a canonical `Image.Plug.Pipeline`.

Recognised keys (canonical name; aliases in parens):

* Resize: `width` (`w`), `height` (`h`), `fit`, `gravity` (`g`),
  `dpr`, `zoom` / `face-zoom`.

* Output: `quality` (`q`), `format` (`f`), `metadata`, `anim`,
  `compression`, `slow-connection-quality` (`scq`).

* Effects: `background`, `blur`, `sharpen`, `brightness`,
  `contrast`, `gamma`, `saturation`.

* Geometry: `rotate`, `flip`, `trim`, `border`.

* Misc: `segment`, `onerror`.

Aliases normalise to the canonical key before dispatch. Unknown
keys raise `:unknown_option` by default; pass `strict?: false` to
log and ignore them. Drawing/overlays via the URL `draw=` grammar
(`url(...)`, `width`, `height`, `fit`, `gravity`, `opacity`, `top`,
`left`, `bottom`, `right`, `rotate`, `repeat`, `background`) are
parsed into `Ops.Draw` layers.

# `parse`

```elixir
@spec parse(
  String.t(),
  keyword()
) :: {:ok, Image.Plug.Pipeline.t()} | {:error, Image.Plug.Error.t()}
```

Parses an options string into a `Image.Plug.Pipeline`.

### Arguments

* `options_string` is the comma-separated `<options>` segment from
  the request URL.

* `parser_options` is a keyword list controlling parsing behaviour.

### Options

* `:strict?` — if `true` (the default), unknown option keys produce
  `{:error, %Image.Plug.Error{tag: :unknown_option}}`. If `false`,
  unknown keys are logged and ignored.

### Returns

* `{:ok, pipeline}` on success.

* `{:error, %Image.Plug.Error{}}` on the first malformed entry.

### Examples

    iex> alias Image.Plug.Provider.Cloudflare.Options
    iex> {:ok, pipeline} = Options.parse("width=200,fit=cover,format=webp", [])
    iex> [resize] = pipeline.ops
    iex> {resize.width, resize.fit}
    {200, :cover}
    iex> pipeline.output.type
    :webp

---

*Consult [api-reference.md](api-reference.md) for complete listing*
