Neos\Media\Domain\Model\Image::calculateDimensionsFromResource PHP Method

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
    protected function calculateDimensionsFromResource(PersistentResource $resource)
    {
        try {
            $imageSize = $this->imageService->getImageSize($resource);
        } catch (ImageFileException $imageFileException) {
            throw new ImageFileException(sprintf('Tried to refresh the dimensions and meta data of Image asset "%s" but the file of resource "%s" does not exist or is not a valid image.', $this->getTitle(), $resource->getSha1()), 1381141468, $imageFileException);
        }
        $this->width = is_int($imageSize['width']) ? $imageSize['width'] : null;
        $this->height = is_int($imageSize['height']) ? $imageSize['height'] : null;
    }