FluidTYPO3\Vhs\ViewHelpers\Media\Image\AbstractImageInfoViewHelper::getInfo PHP Метод

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

public getInfo ( ) : array
Результат array
    public function getInfo()
    {
        $src = $this->arguments['src'];
        $treatIdAsUid = (bool) $this->arguments['treatIdAsUid'];
        $treatIdAsReference = (bool) $this->arguments['treatIdAsReference'];
        if (null === $src) {
            $src = $this->renderChildren();
            if (null === $src) {
                return [];
            }
        }
        if (is_object($src) && $src instanceof FileReference) {
            $src = $src->getUid();
            $treatIdAsUid = true;
            $treatIdAsReference = true;
        }
        if (true === $treatIdAsUid || true === $treatIdAsReference) {
            $id = (int) $src;
            $info = [];
            if (true === $treatIdAsUid) {
                $info = $this->getInfoByUid($id);
            } elseif (true === $treatIdAsReference) {
                $info = $this->getInfoByReference($id);
            }
        } else {
            $file = GeneralUtility::getFileAbsFileName($src);
            if (false === file_exists($file) || true === is_dir($file)) {
                throw new Exception('Cannot determine info for "' . $file . '". File does not exist or is a directory.', 1357066532);
            }
            $imageSize = getimagesize($file);
            $info = ['width' => $imageSize[0], 'height' => $imageSize[1], 'type' => $imageSize['mime']];
        }
        return $info;
    }