public function getVariation(
        Field $field,
        VersionInfo $versionInfo,
        $variationName,
        array $parameters = []
    ) {
        /** @var \eZ\Publish\SPI\Variation\Values\ImageVariation $variation */
        $variation = $this->aliasGenerator->getVariation(
            $field,
            $versionInfo,
            $variationName,
            $parameters
        );

        if (null === $variation->width || null === $variation->height) {
            $variationBinaryFile = $this->getVariationBinaryFile($field->value->id, $variationName);
            $image = $this->imagine->load($this->ioService->getFileContents($variationBinaryFile));
            $dimensions = $image->getSize();

            return new ImageVariation(
                [
                    'name' => $variation->name,
                    'fileName' => $variation->fileName,
                    'dirPath' => $variation->dirPath,
                    'uri' => $variation->uri,
                    'imageId' => $variation->imageId,
                    'width' => $dimensions->getWidth(),
                    'height' => $dimensions->getHeight(),
                    'fileSize' => $variationBinaryFile->size,
                    'mimeType' => $this->ioService->getMimeType($variationBinaryFile->id),
                    'lastModified' => $variationBinaryFile->mtime,
                ]
            );
        }

        return $variation;
    }
public function getVariation(
        Field $field,
        VersionInfo $versionInfo,
        $variationName,
        array $parameters = []
    ) {
        /** @var \eZ\Publish\SPI\Variation\Values\ImageVariation $variation */
        $variation = $this->aliasGenerator->getVariation(
            $field,
            $versionInfo,
            $variationName,
            $parameters
        );

        if (null === $variation->width || null === $variation->height) {
            $variationBinaryFile = $this->getVariationBinaryFile($field->value->id, $variationName);
            $image = $this->imagine->load($this->ioService->getFileContents($variationBinaryFile));
            $dimensions = $image->getSize();

            return new ImageVariation(
                [
                    'name' => $variation->name,
                    'fileName' => $variation->fileName,
                    'dirPath' => $variation->dirPath,
                    'uri' => $variation->uri,
                    'imageId' => $variation->imageId,
                    'width' => $dimensions->getWidth(),
                    'height' => $dimensions->getHeight(),
                    'fileSize' => $variationBinaryFile->size,
                    'mimeType' => $this->ioService->getMimeType($variationBinaryFile->id),
                    'lastModified' => $variationBinaryFile->mtime,
                ]
            );
        }

        return $variation;
    }
public function getVariation ( Field $ field , VersionInfo $ versionInfo , $ variationName , array $ parameters = [ ] ) { /** @var \eZ\Publish\SPI\Variation\Values\ImageVariation $variation */ $ variation = $ this -> aliasGenerator -> getVariation ( $ field , $ versionInfo , $ variationName , $ parameters ) ; if ( null === $ variation -> width || null === $ variation -> height ) { $ variationBinaryFile = $ this -> getVariationBinaryFile ( $ field -> value -> id , $ variationName ) ; $ image = $ this -> imagine -> load ( $ this -> ioService -> getFileContents ( $ variationBinaryFile ) ) ; $ dimensions = $ image -> getSize ( ) ; return new ImageVariation ( [ 'name' => $ variation -> name , 'fileName' => $ variation -> fileName , 'dirPath' => $ variation -> dirPath , 'uri' => $ variation -> uri , 'imageId' => $ variation -> imageId , 'width' => $ dimensions -> getWidth ( ) , 'height' => $ dimensions -> getHeight ( ) , 'fileSize' => $ variationBinaryFile -> size , 'mimeType' => $ this -> ioService -> getMimeType ( $ variationBinaryFile -> id ) , 'lastModified' => $ variationBinaryFile -> mtime , ] ) ; } return $ variation ; }
Returns a Variation object, ensuring proper image dimensions.

{@inheritdoc}

@throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
@throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
Returns a Variation object ensuring proper image dimensions .