2 declare(strict_types = 1);
87 protected $allowedExtensions = [
'png',
'jpg',
'jpeg',
'gif',
'webp',
'tif',
'tiff',
'bmp',
'pcx',
'tga',
'ico'];
94 protected $deniedExtensions = [
'epi',
'eps',
'eps2',
'eps3',
'epsf',
'epsi',
'ept',
'ept2',
'ept3',
'msl',
'ps',
'ps2',
'ps3'];
104 'image/png' =>
'png',
105 'image/jpeg' =>
'jpg',
106 'image/gif' =>
'gif',
107 'image/heic' =>
'heic',
108 'image/heif' =>
'heif',
109 'image/webp' =>
'webp',
110 'image/svg' =>
'svg',
111 'image/svg+xml' =>
'svg',
112 'image/tiff' =>
'tif',
113 'application/pdf' =>
'pdf',
123 return GeneralUtility::makeInstance(
140 $this->fileExtension = pathinfo(
$filePath, PATHINFO_EXTENSION);
142 if ($this->fileExists) {
144 $this->mimeType = $fileInfo->getMimeType();
145 $this->mimeExtensions = $fileInfo->getMimeExtensions();
148 $this->asArgument = $this->
escape(
150 . ($this->frame !==
null ?
'[' . $this->frame .
']' :
'')
175 $prefixExtension =
null;
177 if ($this->mimeType !==
null && !empty($this->mimeTypeExtensionMap[$this->mimeType])) {
179 } elseif (!empty($this->mimeExtensions) && strpos((
string)$this->mimeType,
'image/') === 0) {
180 $prefixExtension = $this->mimeExtensions[0];
184 if ($prefixExtension !==
null && !in_array(strtolower($prefixExtension), $this->deniedExtensions,
true)) {
185 return $prefixExtension .
':';
189 'Unsupported file %s (%s)',
190 basename($this->filePath),
191 $this->mimeType ??
'unknown'
201 protected function escape(
string $value): string
212 return in_array($extension, $this->allowedExtensions,
true);
221 return GeneralUtility::makeInstance(FileInfo::class,
$filePath);