Parses a Cloudinary transform string
into a canonical Image.Plug.Pipeline.
Cloudinary's transform vocabulary is large (~100+ keys). v0.1 implements the common subset that maps cleanly onto the canonical IR:
Sizing:
w_,h_,dpr_,c_(crop mode),g_(gravity),x_/y_(focal point — derived together withg_xy_center).Output:
q_,f_.Effects:
b_(background),e_blur:,e_sharpen:,e_brightness:,e_contrast:,e_saturation:,e_gamma:.Geometry:
a_(rotate, multiples of 90),e_grayscale(treated asAdjust{saturation: 0.0}),bo_(borderbo_<W>px_solid_<color>).Overlays:
l_<public-id>(single-layer base form).
Multiple transform stages (w_200,c_fill/e_blur:300/) are
flattened by the URL recogniser into a single comma-joined string;
this parser then walks them as one set. The canonical IR doesn't
model chained transforms in v0.1, so order-dependent multi-stage
recipes (sharpen → resize → sharpen) collapse to last-write-wins.
This is documented in guides/cloudinary_conformance.md.
Cloudinary-only features that don't fit the canonical IR
(e_vignette, e_pixelate, e_cartoonify, e_replace_color,
e_fade, cs_srgb, named transformations t_<name>) raise
:unsupported_option so users learn early.
Summary
Functions
Parses a Cloudinary transform string into an Image.Plug.Pipeline.
Functions
@spec parse( String.t(), keyword() ) :: {:ok, Image.Plug.Pipeline.t()} | {:error, Image.Plug.Error.t()}
Parses a Cloudinary transform string into an Image.Plug.Pipeline.
Arguments
transform_string— the comma-joined transform string emitted byImage.Plug.Provider.Cloudinary.URL(multiple stages are pre-flattened to one comma-separated list).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.Cloudinary.Options
iex> {:ok, pipeline} = Options.parse("w_200,c_fill,f_webp,q_80")
iex> [resize] = pipeline.ops
iex> {resize.width, resize.fit}
{200, :cover}
iex> pipeline.output.type
:webp