2 namespace TYPO3\CMS\Frontend\Controller;
81 <title>###TITLE###</title>
82 <meta name=
"robots" content=
"noindex,follow" />
93 protected $imageTag =
'<img src="###publicUrl###" alt="###alt###" title="###title###" width="###width###" height="###height###" />';
104 $fileUid = isset($this->request->getQueryParams()[
'file']) ? $this->request->getQueryParams()[
'file'] : null;
105 $parametersArray = isset($this->request->getQueryParams()[
'parameters']) ? $this->request->getQueryParams()[
'parameters'] : null;
108 if (!$fileUid || !isset($parametersArray) || !is_array($parametersArray)) {
109 throw new \InvalidArgumentException(
'No valid fileUid given');
113 $parametersEncoded = implode(
'', $parametersArray);
116 $hmacParameter = isset($this->request->getQueryParams()[
'md5']) ? $this->request->getQueryParams()[
'md5'] : null;
118 if ($hmac !== $hmacParameter) {
119 throw new \InvalidArgumentException(
'hash does not match');
123 $parameters = unserialize(base64_decode($parametersEncoded));
124 foreach ($parameters as $parameterName => $parameterValue) {
125 $this->{$parameterName} = $parameterValue;
133 $this->frame = isset($this->request->getQueryParams()[
'frame']) ? $this->request->getQueryParams()[
'frame'] : null;
145 $imageTagMarkers = array(
146 '###publicUrl###' => htmlspecialchars($processedImage->getPublicUrl()),
147 '###alt###' => htmlspecialchars($this->file->getProperty(
'alternative') ?:
$this->title),
148 '###title###' => htmlspecialchars($this->file->getProperty(
'title') ?:
$this->title),
149 '###width###' => $processedImage->getProperty(
'width'),
150 '###height###' => $processedImage->getProperty(
'height')
152 $this->imageTag = str_replace(array_keys($imageTagMarkers), array_values($imageTagMarkers), $this->imageTag);
153 $markerArray = array(
154 '###TITLE###' => ($this->file->getProperty(
'title') ?:
$this->title),
155 '###IMAGE###' => $this->imageTag,
156 '###BODY###' => $this->bodyTag
159 $this->content = str_replace(array_keys($markerArray), array_values($markerArray), $this->content);
169 if (strstr($this->width . $this->height,
'm')) {
177 $processingConfiguration = array(
178 'width' => $this->width,
179 'height' => $this->height,
180 'frame' => $this->frame,
183 return $this->file->process(
'Image.CropScaleMask', $processingConfiguration);
200 $response->
getBody()->write($this->content);
202 }
catch (\InvalidArgumentException $e) {