PHP Class Neos\Media\Domain\Model\Image

Inheritance: extends Asset, implements Neos\Media\Domain\Model\ImageInterface, implements Neos\Media\Domain\Model\VariantSupportInterface, use trait DimensionsTrait
Show file Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$imageService Neos\Media\Domain\Service\ImageService
$variants Collection<\Neos\Media\Domain\Model\ImageVariant>

Public Methods

Method Description
__construct ( PersistentResource $resource ) Constructor
addVariant ( ImageVariant $variant ) : void Adds a variant of this image
getVariants ( ) : array Returns all variants (if any) derived from this asset
initializeObject ( integer $initializationCause ) : void
refresh ( ) : void Calculates image width and height from the image resource.

Protected Methods

Method Description
calculateDimensionsFromResource ( PersistentResource $resource ) : void Calculates and sets the width and height of this Image asset based on the given PersistentResource.

Method Details

__construct() public method

Constructor
public __construct ( PersistentResource $resource )
$resource Neos\Flow\ResourceManagement\PersistentResource

addVariant() public method

Note that you should try to re-use variants if you need to adjust them, rather than creating a new variant for every change. Non-used variants will remain in the database and block resource disk space until they are removed explicitly or the original image is deleted.
public addVariant ( ImageVariant $variant ) : void
$variant ImageVariant The new variant
return void

calculateDimensionsFromResource() protected method

Calculates and sets the width and height of this Image asset based on the given PersistentResource.
protected calculateDimensionsFromResource ( PersistentResource $resource ) : void
$resource Neos\Flow\ResourceManagement\PersistentResource
return void

getVariants() public method

Returns all variants (if any) derived from this asset
public getVariants ( ) : array
return array

initializeObject() public method

public initializeObject ( integer $initializationCause ) : void
$initializationCause integer
return void

refresh() public method

Calculates image width and height from the image resource.
public refresh ( ) : void
return void

Property Details

$imageService protected property

protected ImageService,Neos\Media\Domain\Service $imageService
return Neos\Media\Domain\Service\ImageService

$variants protected property

protected Collection<\Neos\Media\Domain\Model\ImageVariant> $variants
return Collection<\Neos\Media\Domain\Model\ImageVariant>