OgEx.ResourceLoader.Default (og_ex v0.2.0)

Copy Markdown View Source

Built-in resource loader.

Public and private files are read from paths already constrained by OgEx.Image. Data URLs are decoded locally. Remote sources are delegated to OgEx.ResourceLoader.Remote.

All bytes pass through native format and dimension inspection. Supported resource types are PNG, JPEG, WebP, GIF, and SVG.

Summary

Functions

Verifies encoded bytes and constructs an OgEx.Image.Resource.

Loads and verifies a normalized source.

Functions

from_bytes(source, bytes)

Verifies encoded bytes and constructs an OgEx.Image.Resource.

Custom loaders can use this boundary to apply the same native type, dimensions, and safe-SVG checks as the default loader.

Returns {:ok, resource} or {:error, {:invalid_image, reason}}.

load(source, options)

Loads and verifies a normalized source.

Local files are read only after OgEx.Image has constrained them to a trusted root. Data URLs and remote responses share the same byte and native image validation.