AssetVariant
in package
FinalYes
Info about one asset variant: name, public url (for `<img src>`), absolute disk path (for {@see exists()}) and real dimensions (from `meta`). A non-Doctrine value object built by {@see \App\Core\Base\Shared\System\Models\Entities\Asset}.
exists() checks the current state on disk via is_file(), not the presence of dimensions in
meta (that is only a snapshot from upload/backfill and may be stale).
Table of Contents
Properties
- $absolutePath : string|null
- $height : int|null
- $name : string
- $url : string
- $width : int|null
Methods
- __construct() : mixed
- exists() : bool
- Whether the variant file physically exists on disk (current state). Dimensions in `meta` would not reflect deleted or missing files.
- getAbsolutePath() : string|null
- Absolute path of the variant file on disk (`null` = could not be derived).
- getDimensions() : array{width: int, height: int}|null
- getHeight() : int|null
- getName() : string
- getUrl() : string
- Public (relative) path of the variant for `<img src>`.
- getWidth() : int|null
Properties
$absolutePath read-only
private
string|null
$absolutePath
= null
$height read-only
private
int|null
$height
= null
$name read-only
private
string
$name
$url read-only
private
string
$url
= ''
$width read-only
private
int|null
$width
= null
Methods
__construct()
public
__construct(string $name[, string $url = '' ][, string|null $absolutePath = null ][, int|null $width = null ][, int|null $height = null ]) : mixed
Parameters
- $name : string
- $url : string = ''
- $absolutePath : string|null = null
- $width : int|null = null
- $height : int|null = null
exists()
Whether the variant file physically exists on disk (current state). Dimensions in `meta` would not reflect deleted or missing files.
public
exists() : bool
Return values
boolgetAbsolutePath()
Absolute path of the variant file on disk (`null` = could not be derived).
public
getAbsolutePath() : string|null
Return values
string|nullgetDimensions()
public
getDimensions() : array{width: int, height: int}|null
Return values
array{width: int, height: int}|nullgetHeight()
public
getHeight() : int|null
Return values
int|nullgetName()
public
getName() : string
Return values
stringgetUrl()
Public (relative) path of the variant for `<img src>`.
public
getUrl() : string
Return values
stringgetWidth()
public
getWidth() : int|null