PHP Класс Neos\Media\Domain\Model\ImageVariant

Наследование: extends Asset, implements Neos\Media\Domain\Model\AssetVariantInterface, implements Neos\Media\Domain\Model\ImageInterface, use trait DimensionsTrait
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$adjustments ArrayCollection<\Neos\Media\Domain\Model\Adjustment\AbstractImageAdjustment>
$imageService Neos\Media\Domain\Service\ImageService
$name string
$originalAsset Image

Открытые методы

Метод Описание
__construct ( Image $originalAsset ) Constructs a new Image Variant based on the given original
addAdjustment ( Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface $adjustment ) : void Adds the given adjustment to the list of adjustments applied to this image variant.
addAdjustments ( array $adjustments ) : void Adds the given adjustments to the list of adjustments applied to this image variant.
addTag ( Tag $tag ) : void Add a single tag to this asset
addVariant ( ImageVariant $variant ) : void Adding variants to variants is not supported.
getAdjustments ( ) : Doctrine\Common\Collections\Collection
getCaption ( ) : string Returns the caption of the original image
getFileExtension ( ) : string File extension of the image without leading dot.
getName ( ) : string Returns the name
getOriginalAsset ( ) : Image Returns the original image this variant is based on
getResource ( ) : PersistentResource Returns the resource of this image variant
getTitle ( ) : string Returns the title of the original image
getVariants ( ) : array Retrieving variants from variants is not supported (no-operation)
initializeObject ( integer $initializationCause ) : void Initialize this image variant
refresh ( ) : void Refreshes this image variant: according to the added adjustments, a new image is rendered and stored as this image variant's resource.
setName ( string $name ) : void Sets a name which can be used for identifying this variant
setResource ( PersistentResource $resource ) : void Setting the image resource on an ImageVariant is not allowed, this method will throw a RuntimeException.
setTags ( Doctrine\Common\Collections\Collection $tags ) : void Set the tags assigned to this asset
setTitle ( string $title ) : void Setting the title on an ImageVariant is not allowed, this method will throw a RuntimeException.

Защищенные методы

Метод Описание
applyAdjustment ( Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface $adjustment ) : void Apply the given adjustment to the image variant.
renderResource ( ) : void Tells the ImageService to render the resource of this ImageVariant according to the existing adjustments.

Описание методов

__construct() публичный Метод

Constructs a new Image Variant based on the given original
public __construct ( Image $originalAsset )
$originalAsset Image The original Image asset this variant is derived from

addAdjustment() публичный Метод

If an adjustment of the given type already exists, the existing one will be overridden by the new one.
public addAdjustment ( Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface $adjustment ) : void
$adjustment Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface The adjustment to apply
Результат void

addAdjustments() публичный Метод

If an adjustment of one of the given types already exists, the existing one will be overridden by the new one.
public addAdjustments ( array $adjustments ) : void
$adjustments array
Результат void

addTag() публичный Метод

Add a single tag to this asset
public addTag ( Tag $tag ) : void
$tag Tag
Результат void

addVariant() публичный Метод

Adding variants to variants is not supported.
public addVariant ( ImageVariant $variant ) : void
$variant ImageVariant
Результат void

applyAdjustment() защищенный Метод

If an adjustment of the given type already exists, the existing one will be overridden by the new one.
protected applyAdjustment ( Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface $adjustment ) : void
$adjustment Neos\Media\Domain\Model\Adjustment\ImageAdjustmentInterface
Результат void

getAdjustments() публичный Метод

public getAdjustments ( ) : Doctrine\Common\Collections\Collection
Результат Doctrine\Common\Collections\Collection

getCaption() публичный Метод

Returns the caption of the original image
public getCaption ( ) : string
Результат string

getFileExtension() публичный Метод

This will return the file extension of the original image as this should not be different in image variants
public getFileExtension ( ) : string
Результат string

getName() публичный Метод

Returns the name
public getName ( ) : string
Результат string

getOriginalAsset() публичный Метод

Returns the original image this variant is based on
public getOriginalAsset ( ) : Image
Результат Image

getResource() публичный Метод

Returns the resource of this image variant
public getResource ( ) : PersistentResource
Результат Neos\Flow\ResourceManagement\PersistentResource

getTitle() публичный Метод

Returns the title of the original image
public getTitle ( ) : string
Результат string

getVariants() публичный Метод

Retrieving variants from variants is not supported (no-operation)
public getVariants ( ) : array
Результат array

initializeObject() публичный Метод

This method will generate the resource of this asset when this object has just been newly created. We can't run renderResource() in the constructor since not all dependencies have been injected then. Generating resources lazily in the getResource() method is not feasible either, because getters will be triggered by the validation mechanism on flushing the persistence which will result in undefined behavior. We don't call refresh() here because we only want the resource to be rendered, not all other refresh actions from parent classes being executed.
public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
Результат void

refresh() публичный Метод

Refreshes this image variant: according to the added adjustments, a new image is rendered and stored as this image variant's resource.
См. также: getResource()
public refresh ( ) : void
Результат void

renderResource() защищенный Метод

Tells the ImageService to render the resource of this ImageVariant according to the existing adjustments.
protected renderResource ( ) : void
Результат void

setName() публичный Метод

Sets a name which can be used for identifying this variant
public setName ( string $name ) : void
$name string
Результат void

setResource() публичный Метод

Setting the image resource on an ImageVariant is not allowed, this method will throw a RuntimeException.
public setResource ( PersistentResource $resource ) : void
$resource Neos\Flow\ResourceManagement\PersistentResource
Результат void

setTags() публичный Метод

Set the tags assigned to this asset
public setTags ( Doctrine\Common\Collections\Collection $tags ) : void
$tags Doctrine\Common\Collections\Collection
Результат void

setTitle() публичный Метод

Setting the title on an ImageVariant is not allowed, this method will throw a RuntimeException.
public setTitle ( string $title ) : void
$title string
Результат void

Описание свойств

$adjustments защищенное свойство

protected ArrayCollection<\Neos\Media\Domain\Model\Adjustment\AbstractImageAdjustment> $adjustments
Результат ArrayCollection<\Neos\Media\Domain\Model\Adjustment\AbstractImageAdjustment>

$imageService защищенное свойство

protected ImageService,Neos\Media\Domain\Service $imageService
Результат Neos\Media\Domain\Service\ImageService

$name защищенное свойство

protected string $name
Результат string

$originalAsset защищенное свойство

protected Image,Neos\Media\Domain\Model $originalAsset
Результат Image