class ImageAsset implements Asset, HtmlRenderable

Image asset.

Properties

$width
$height
$mimeType

Methods

__construct(string $url, string|null $file = null, int|null $width = null, int|null $height = null, string|null $mimeType = null, string|null $alternative = null, bool $lazyLoad = false, int $density = 1, string|bool|null $crossorigin = null)

No description

string
__toString()

Returns the asset URL.

Html
getImportElement()

Returns the HTML element used to import the asset (img, script, link rel="stylesheet", etc.).

Html
getPreloadElement()

Returns the HTML element used to preload the asset (link rel="preload" or rel="modulepreload").

Details

at line 21
__construct(string $url, string|null $file = null, int|null $width = null, int|null $height = null, string|null $mimeType = null, string|null $alternative = null, bool $lazyLoad = false, int $density = 1, string|bool|null $crossorigin = null)

No description

Parameters

string $url
string|null $file
int|null $width
int|null $height
string|null $mimeType
string|null $alternative
bool $lazyLoad
int $density
string|bool|null $crossorigin

at line 37
string __toString()

Returns the asset URL.

Return Value

string

at line 63
Html getImportElement()

Returns the HTML element used to import the asset (img, script, link rel="stylesheet", etc.).

Return Value

Html

at line 76
Html getPreloadElement()

Returns the HTML element used to preload the asset (link rel="preload" or rel="modulepreload").

Return Value

Html

Traits

Lazy-loading of properties as a workaround for PHP < 8.4.