FluidTYPO3\Vhs\ViewHelpers\Resource\AbstractImageViewHelper::preprocessImages PHP Method

preprocessImages() public method

public preprocessImages ( array $files, boolean $onlyProperties = false ) : array | null
$files array
$onlyProperties boolean
return array | null
    public function preprocessImages($files, $onlyProperties = false)
    {
        if (true === empty($files)) {
            return null;
        }
        if ('BE' === TYPO3_MODE) {
            $this->simulateFrontendEnvironment();
        }
        $setup = ['width' => $this->arguments['width'], 'height' => $this->arguments['height'], 'minW' => $this->arguments['minWidth'], 'minH' => $this->arguments['minHeight'], 'maxW' => $this->arguments['maxWidth'], 'maxH' => $this->arguments['maxHeight'], 'treatIdAsReference' => false];
        $images = [];
        foreach ($files as $file) {
            $imageInfo = $this->contentObject->getImgResource($file->getUid(), $setup);
            $GLOBALS['TSFE']->lastImageInfo = $imageInfo;
            if (false === is_array($imageInfo)) {
                throw new Exception('Could not get image resource for "' . htmlspecialchars($file->getCombinedIdentifier()) . '".', 1253191060);
            }
            if ((double) substr(TYPO3_version, 0, 3) < 7.1) {
                $imageInfo[3] = GeneralUtility::png_to_gif_by_imagemagick($imageInfo[3]);
            } else {
                $imageInfo[3] = GraphicalFunctions::pngToGifByImagemagick($imageInfo[3]);
            }
            $imageInfo[3] = GeneralUtility::png_to_gif_by_imagemagick($imageInfo[3]);
            $GLOBALS['TSFE']->imagesOnPage[] = $imageInfo[3];
            if (true === GeneralUtility::isValidUrl($imageInfo[3])) {
                $imageSource = $imageInfo[3];
            } else {
                $imageSource = $GLOBALS['TSFE']->absRefPrefix . GeneralUtility::rawUrlEncodeFP($imageInfo[3]);
            }
            if (true === $onlyProperties) {
                $file = ResourceUtility::getFileArray($file);
            }
            $images[] = ['info' => $imageInfo, 'source' => $imageSource, 'file' => $file];
        }
        if ('BE' === TYPO3_MODE) {
            $this->resetFrontendEnvironment();
        }
        return $images;
    }