Behaviour for source resolvers.
A resolver turns a Image.Plug.Source.t/0 into an open
Vix.Vips.Image plus a small bag of metadata used for HTTP cache
headers (content_type, etag_seed, optionally last_modified and
byte_size).
A resolver typically handles one Image.Plug.Source kind. The
default Image.Plug.SourceResolver.Composite dispatches by kind to
a configured set of per-kind resolvers.
Summary
Types
Metadata about the resolved source. The plug uses these values to build cache headers and to fingerprint the response for ETag computation.
Callbacks
Loads the source bytes referenced by source and opens them as a
Vix.Vips.Image.
Types
@type meta() :: %{ :content_type => String.t(), :etag_seed => binary(), optional(:last_modified) => DateTime.t(), optional(:byte_size) => non_neg_integer(), optional(:cache_control) => String.t(), optional(:immutable?) => boolean() }
Metadata about the resolved source. The plug uses these values to build cache headers and to fingerprint the response for ETag computation.
:content_type— the MIME type of the source bytes.:etag_seed— any stable per-source binary.Image.Plug.Cachehashes this together with the pipeline fingerprint to compute the response ETag.:last_modified— optionalDateTimeto emit asLast-Modified.:byte_size— optional integer; informational.:cache_control— optionalCache-Controldirective to forward on the response.:immutable?— iftrue, the cache layer may addimmutable.
Callbacks
@callback load(Image.Plug.Source.t(), options :: keyword()) :: {:ok, Vix.Vips.Image.t(), meta()} | {:error, Image.Plug.Error.t()}
Loads the source bytes referenced by source and opens them as a
Vix.Vips.Image.
Returns the open image plus a meta/0 map.