Parses an imgix
query string into a canonical Image.Plug.Pipeline.
Imgix exposes ~80 documented parameters. v0.1 implements the common subset that maps cleanly onto the canonical IR:
Sizing:
w,h,dpr,fit,crop,fp-x,fp-y.Output:
q,fm,auto(multi-valueformat,compress).Effects:
bg,blur,sharp,bri,con,sat,gam.Geometry:
flip,rot,trim,trimcolor,border.Overlays:
mark,mark-w,mark-h,mark-x,mark-y,mark-fit,mark-rot.Signing:
s,expires— handled byImage.Plug.Provider.Imgix.Signing, not here.
Unknown keys raise :unknown_option by default; pass
strict?: false to log and ignore.
Custom-ICC colourspaces (cs=adobergb1998, cs=appleRGB, etc.)
return :unsupported_option — the parser does not synthesise
those from URL strings. Construct an Ops.IccTransform{profile, intent} op directly, or wire an application-level alias map.
See guides/imgix_conformance.md for the per-option matrix.
Summary
Functions
Parses an imgix query string into an Image.Plug.Pipeline.
Functions
@spec parse( String.t(), keyword() ) :: {:ok, Image.Plug.Pipeline.t()} | {:error, Image.Plug.Error.t()}
Parses an imgix query string into an Image.Plug.Pipeline.
Arguments
query_string— the raw query string (no leading?).parser_options— keyword list.:strict?(defaulttrue) controls whether unknown keys raise.
Returns
{:ok, pipeline}on success.{:error, %Image.Plug.Error{}}on the first malformed entry.
Examples
iex> alias Image.Plug.Provider.Imgix.Options
iex> {:ok, pipeline} = Options.parse("w=200&fit=crop&fm=webp&q=80")
iex> [resize] = pipeline.ops
iex> {resize.width, resize.fit}
{200, :cover}
iex> pipeline.output.type
:webp