public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = [])
    {
        $variationIdentifier = "$field->id-$versionInfo->versionNo-$variationName";
        if (isset($this->variations[$variationIdentifier])) {
            return $this->variations[$variationIdentifier];
        }

        // Assigning by reference to be able to modify those arrays within the closure (due to PHP 5.3 limitation with access to $this)
        $allAliasHandlers = &$this->aliasHandlers;
        $allVariations = &$this->variations;

        return $this->getLegacyKernel()->runCallback(
            static function () use ($field, $versionInfo, $variationName, &$allAliasHandlers, &$allVariations, $variationIdentifier) {
                $aliasHandlerIdentifier = "$field->id-$versionInfo->versionNo";
                if (!isset($allAliasHandlers[$aliasHandlerIdentifier])) {
                    $allAliasHandlers[$aliasHandlerIdentifier] = new eZImageAliasHandler(
                        eZContentObjectAttribute::fetch($field->id, $versionInfo->versionNo)
                    );
                }

                /** @var $imageAliasHandler \eZImageAliasHandler */
                $imageAliasHandler = $allAliasHandlers[$aliasHandlerIdentifier];
                $aliasArray = $imageAliasHandler->imageAlias($variationName);
                if ($aliasArray === null) {
                    throw new InvalidVariationException($variationName, 'image');
                }

                $allVariations[$variationIdentifier] = new ImageVariation(
                    [
                        'name' => $variationName,
                        'fileName' => $aliasArray['filename'],
                        'dirPath' => $aliasArray['dirpath'],
                        'fileSize' => isset($aliasArray['filesize']) ? $aliasArray['filesize'] : 0,
                        'mimeType' => $aliasArray['mime_type'],
                        'lastModified' => new \DateTime('@' . $aliasArray['timestamp']),
                        'uri' => $aliasArray['url'],
                        'width' => $aliasArray['width'],
                        'height' => $aliasArray['height'],
                        'imageId' => sprintf('%d-%d', $versionInfo->contentInfo->id, $field->id),
                    ]
                );

                return $allVariations[$variationIdentifier];
            },
            false,
            false
        );
    }
public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = [])
    {
        $variationIdentifier = "$field->id-$versionInfo->versionNo-$variationName";
        if (isset($this->variations[$variationIdentifier])) {
            return $this->variations[$variationIdentifier];
        }

        // Assigning by reference to be able to modify those arrays within the closure (due to PHP 5.3 limitation with access to $this)
        $allAliasHandlers = &$this->aliasHandlers;
        $allVariations = &$this->variations;

        return $this->getLegacyKernel()->runCallback(
            static function () use ($field, $versionInfo, $variationName, &$allAliasHandlers, &$allVariations, $variationIdentifier) {
                $aliasHandlerIdentifier = "$field->id-$versionInfo->versionNo";
                if (!isset($allAliasHandlers[$aliasHandlerIdentifier])) {
                    $allAliasHandlers[$aliasHandlerIdentifier] = new eZImageAliasHandler(
                        eZContentObjectAttribute::fetch($field->id, $versionInfo->versionNo)
                    );
                }

                /** @var $imageAliasHandler \eZImageAliasHandler */
                $imageAliasHandler = $allAliasHandlers[$aliasHandlerIdentifier];
                $aliasArray = $imageAliasHandler->imageAlias($variationName);
                if ($aliasArray === null) {
                    throw new InvalidVariationException($variationName, 'image');
                }

                $allVariations[$variationIdentifier] = new ImageVariation(
                    [
                        'name' => $variationName,
                        'fileName' => $aliasArray['filename'],
                        'dirPath' => $aliasArray['dirpath'],
                        'fileSize' => isset($aliasArray['filesize']) ? $aliasArray['filesize'] : 0,
                        'mimeType' => $aliasArray['mime_type'],
                        'lastModified' => new \DateTime('@' . $aliasArray['timestamp']),
                        'uri' => $aliasArray['url'],
                        'width' => $aliasArray['width'],
                        'height' => $aliasArray['height'],
                        'imageId' => sprintf('%d-%d', $versionInfo->contentInfo->id, $field->id),
                    ]
                );

                return $allVariations[$variationIdentifier];
            },
            false,
            false
        );
    }
public function getVariation ( Field $ field , VersionInfo $ versionInfo , $ variationName , array $ parameters = [ ] ) { $ variationIdentifier = "$field->id-$versionInfo->versionNo-$variationName" ; if ( isset ( $ this -> variations [ $ variationIdentifier ] ) ) { return $ this -> variations [ $ variationIdentifier ] ; } // Assigning by reference to be able to modify those arrays within the closure (due to PHP 5.3 limitation with access to $this) $ allAliasHandlers = & $ this -> aliasHandlers ; $ allVariations = & $ this -> variations ; return $ this -> getLegacyKernel ( ) -> runCallback ( static function ( ) use ( $ field , $ versionInfo , $ variationName , & $ allAliasHandlers , & $ allVariations , $ variationIdentifier ) { $ aliasHandlerIdentifier = "$field->id-$versionInfo->versionNo" ; if ( ! isset ( $ allAliasHandlers [ $ aliasHandlerIdentifier ] ) ) { $ allAliasHandlers [ $ aliasHandlerIdentifier ] = new eZImageAliasHandler ( eZContentObjectAttribute :: fetch ( $ field -> id , $ versionInfo -> versionNo ) ) ; } /** @var $imageAliasHandler \eZImageAliasHandler */ $ imageAliasHandler = $ allAliasHandlers [ $ aliasHandlerIdentifier ] ; $ aliasArray = $ imageAliasHandler -> imageAlias ( $ variationName ) ; if ( $ aliasArray === null ) { throw new InvalidVariationException ( $ variationName , 'image' ) ; } $ allVariations [ $ variationIdentifier ] = new ImageVariation ( [ 'name' => $ variationName , 'fileName' => $ aliasArray [ 'filename' ] , 'dirPath' => $ aliasArray [ 'dirpath' ] , 'fileSize' => isset ( $ aliasArray [ 'filesize' ] ) ? $ aliasArray [ 'filesize' ] : 0 , 'mimeType' => $ aliasArray [ 'mime_type' ] , 'lastModified' => new \ DateTime ( '@' . $ aliasArray [ 'timestamp' ] ) , 'uri' => $ aliasArray [ 'url' ] , 'width' => $ aliasArray [ 'width' ] , 'height' => $ aliasArray [ 'height' ] , 'imageId' => sprintf ( '%d-%d' , $ versionInfo -> contentInfo -> id , $ field -> id ) , ] ) ; return $ allVariations [ $ variationIdentifier ] ; } , false , false ) ; }
Returns an image variation object.
Variation creation will be done through the legacy eZImageAliasHandler, using the legacy kernel.

@param \eZ\Publish\API\Repository\Values\Content\Field $field
@param \eZ\Publish\API\Repository\Values\Content\VersionInfo $versionInfo
@param string $variationName
@param array $parameters

@throws \eZ\Publish\API\Repository\Exceptions\InvalidVariationException

@return \eZ\Publish\SPI\Variation\Values\ImageVariation
Returns an image variation object . Variation creation will be done through the legacy eZImageAliasHandler using the legacy kernel .