2 namespace TYPO3\CMS\Rtehtmlarea\Controller;
18 use TYPO3\CMS\Core\Resource;
75 $fileUid = (int)$imageAttributes[
'data-htmlarea-file-uid'];
78 $file = Resource\ResourceFactory::getInstance()->getFileObject($fileUid);
79 if ($imageAttributes[
'src'] !== $file->getPublicUrl()) {
81 $imageConfiguration = array(
82 'width' => (
int)$imageAttributes[
'width'],
83 'height' => (
int)$imageAttributes[
'height']
85 $processedFile = $this->getMagicImageService()->createMagicImage($file, $imageConfiguration);
86 $additionalAttributes = array(
87 'src' => $processedFile->getPublicUrl(),
88 'title' => $imageAttributes[
'title'] ?: $file->getProperty(
'title'),
89 'alt' => $imageAttributes[
'alt'] ?: $file->getProperty(
'alternative'),
90 'width' => $processedFile->getProperty(
'width'),
91 'height' => $processedFile->getProperty(
'height'),
93 $imageAttributes = array_merge($imageAttributes, $additionalAttributes);
95 }
catch (Resource\
Exception\FileDoesNotExistException $fileDoesNotExistException) {
97 $message = sprintf(
'I could not find file with uid "%s"', $fileUid);
98 $this->getLogger()->error($message);
112 return $this->cObj->parameters;
120 protected function getMagicImageService()
127 $pageTSConfig = $this->frontendController->getPagesTSconfig();
128 if (is_array($pageTSConfig) && is_array($pageTSConfig[
'RTE.'][
'default.'])) {
129 $magicImageService->setMagicImageMaximumDimensions($pageTSConfig[
'RTE.'][
'default.']);
132 return $magicImageService;
142 $srcAbsoluteUrl = $this->cObj->parameters[
'src'];
143 return strtolower(substr($srcAbsoluteUrl, 0, 4)) ===
'http' || substr($srcAbsoluteUrl, 0, 2) ===
'//';
149 protected function getLogger()
155 return $logManager->getLogger(get_class($this));