ImageAsset
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
at line 37
string
__toString()
Returns the asset URL.
at line 63
Html
getImportElement()
Returns the HTML element used to import the asset (img, script, link rel="stylesheet", etc.).
at line 76
Html
getPreloadElement()
Returns the HTML element used to preload the asset (link rel="preload" or rel="modulepreload").
Traits
Lazy-loading of properties as a workaround for PHP < 8.4.