Next.js-like image function component for Phoenix templates.
Import this module and use:
<.image src="/images/logo.png" alt="Logo" width={240} height={120} />
Summary
Functions
Returns normalized <img> attributes for the given image assigns.
Functions
Attributes
src(:string) (required)alt(:string) (required)width(:integer) - Defaults tonil.height(:integer) - Defaults tonil.fill(:boolean) - Defaults tofalse.sizes(:string) - Defaults tonil.quality(:integer) - Defaults tonil.format(:string) - Defaults to"webp". Must be one of"webp","avif","jpg", or"png".loading(:string) - Defaults to"lazy". Must be one of"lazy", or"eager".preload(:boolean) - Defaults tofalse.unoptimized(:boolean) - Defaults tofalse.upscale(:boolean) - Defaults tofalse.path(:string) - Defaults tonil.allowed_hosts(:list) - Defaults tonil.- Global attributes are accepted.
Returns normalized <img> attributes for the given image assigns.