class Asset implements AssetInterface (View source)

An Asset, the base for all more specific assets in this package.

It can be used as is to represent any asset for which no better match is available.

Properties

protected PersistenceManagerInterface $persistenceManager
protected LoggerInterface $systemLogger
protected ResourceManager $resourceManager
protected ThumbnailService $thumbnailService
protected AssetService $assetService
protected AssetRepository $assetRepository
protected ImportedAssetRepository $importedAssetRepository
protected DateTime $lastModified
protected string $title
protected string $caption
protected string $copyrightNotice
protected PersistentResource $resource
protected Thumbnail> $thumbnails
protected Tag> $tags
protected AssetCollection> $assetCollections
string $assetSourceIdentifier
protected array $assetSourcesConfiguration
protected AssetSourceInterface[] $assetSources

Methods

__construct(PersistentResource $resource)

Constructs an asset. The resource is set internally and then initialize() is called.

void
initializeObject(int $initializationCause)

No description

void
initialize()

Override this to initialize upon instantiation.

string
getIdentifier()

No description

string
getLabel()

No description

getLastModified()

Returns the last modification timestamp for this asset

void
setResource(PersistentResource $resource)

Sets the asset resource and (re-)initializes the asset.

PersistentResource
getResource()

PersistentResource of the original file

string
getFileExtension()

Returns a file extension fitting to the media type of this asset

string
getMediaType()

Returns the IANA media type of this asset

void
setTitle(string $title)

Sets the title of this image (optional)

string
getTitle()

The title of this image

void
setCaption(string $caption)

Sets the caption of this asset (optional)

string
getCaption()

The caption of this asset

string
getCopyrightNotice()

No description

void
setCopyrightNotice(string $copyrightNotice)

No description

Collection
getTags()

Return the tags assigned to this asset

bool
addTag(Tag $tag)

Add a single tag to this asset

getThumbnail(int $maximumWidth = null, int $maximumHeight = null, string $ratioMode = ImageInterface::RATIOMODE_INSET, bool $allowUpScaling = null)

Returns a thumbnail of this asset

mixed
addThumbnail(Thumbnail $thumbnail)

An internal method which adds a thumbnail which was generated by the ThumbnailService.

void
refresh()

Refreshes this asset after the Resource or any other parameters affecting thumbnails have been modified

void
setTags(Collection $tags)

Set the tags assigned to this asset

bool
removeTag(Tag $tag)

Remove a single tag from this asset

Collection
getAssetCollections()

Return the asset collections this asset is included in

void
setAssetCollections(Collection $assetCollections)

Set the asset collections that include this asset

void
setAssetSourceIdentifier(string $assetSourceIdentifier)

Set the asset source identifier for this asset

string|null
getAssetSourceIdentifier()

No description

AssetProxyInterface|null
getAssetProxy()

No description

bool
isInUse()

Returns true if the asset is still in use.

int
getUsageCount()

Returns the number of times the asset is in use.

Details

__construct(PersistentResource $resource)

Constructs an asset. The resource is set internally and then initialize() is called.

Parameters

PersistentResource $resource

Exceptions

Exception

void initializeObject(int $initializationCause)

No description

Parameters

int $initializationCause

Return Value

void

protected void initialize()

Override this to initialize upon instantiation.

Return Value

void

string getIdentifier()

No description

Return Value

string

string getLabel()

No description

Return Value

string

DateTime getLastModified()

Returns the last modification timestamp for this asset

Return Value

DateTime

The date and time of last modification.

void setResource(PersistentResource $resource)

Sets the asset resource and (re-)initializes the asset.

Parameters

PersistentResource $resource

Return Value

void

PersistentResource getResource()

PersistentResource of the original file

Return Value

PersistentResource

string getFileExtension()

Returns a file extension fitting to the media type of this asset

Return Value

string

string getMediaType()

Returns the IANA media type of this asset

Return Value

string

void setTitle(string $title)

Sets the title of this image (optional)

Parameters

string $title

Return Value

void

string getTitle()

The title of this image

Return Value

string

Title of the asset

void setCaption(string $caption)

Sets the caption of this asset (optional)

Parameters

string $caption

Return Value

void

string getCaption()

The caption of this asset

Return Value

string

string getCopyrightNotice()

No description

Return Value

string

void setCopyrightNotice(string $copyrightNotice)

No description

Parameters

string $copyrightNotice

Return Value

void

Collection getTags()

Return the tags assigned to this asset

Return Value

Collection

bool addTag(Tag $tag)

Add a single tag to this asset

Parameters

Tag $tag

The tag to add

Return Value

bool

true if the tag added was new, false if it already existed

Thumbnail getThumbnail(int $maximumWidth = null, int $maximumHeight = null, string $ratioMode = ImageInterface::RATIOMODE_INSET, bool $allowUpScaling = null)

Returns a thumbnail of this asset

If the maximum width / height is not specified or exceeds the original asset's dimensions, the width / height of the original asset is used.

Parameters

int $maximumWidth

The thumbnail's maximum width in pixels

int $maximumHeight

The thumbnail's maximum height in pixels

string $ratioMode

Whether the resulting image should be cropped if both edge's sizes are supplied that would hurt the aspect ratio

bool $allowUpScaling

Whether the resulting image should be upscaled

Return Value

Thumbnail

Exceptions

Exception
Exception

mixed addThumbnail(Thumbnail $thumbnail)

An internal method which adds a thumbnail which was generated by the ThumbnailService.

Parameters

Thumbnail $thumbnail

Return Value

mixed

See also

getThumbnail()

void refresh()

Refreshes this asset after the Resource or any other parameters affecting thumbnails have been modified

Return Value

void

void setTags(Collection $tags)

Set the tags assigned to this asset

Parameters

Collection $tags

Return Value

void

bool removeTag(Tag $tag)

Remove a single tag from this asset

Parameters

Tag $tag

Return Value

bool

Collection getAssetCollections()

Return the asset collections this asset is included in

Return Value

Collection

void setAssetCollections(Collection $assetCollections)

Set the asset collections that include this asset

Parameters

Collection $assetCollections

Return Value

void

void setAssetSourceIdentifier(string $assetSourceIdentifier)

Set the asset source identifier for this asset

This is an internal method which allows Neos / Flow to keep track of assets which were imported from external asset sources.

Parameters

string $assetSourceIdentifier

Return Value

void

string|null getAssetSourceIdentifier()

No description

Return Value

string|null

AssetProxyInterface|null getAssetProxy()

No description

Return Value

AssetProxyInterface|null

bool isInUse()

Returns true if the asset is still in use.

Return Value

bool

int getUsageCount()

Returns the number of times the asset is in use.

Return Value

int