Task #46777
closedImprove behaviour when mime type detection is missing
0%
Description
When no library is available for doing mime type detection, information like the dimensions of images is not indexed. This leads to several problems e.g. in the frontend output.
To better cope with such a situation, we should have
- a reports module that tests if mime type detection works
- a heuristic that tries to guess the file type if no mime type can be extracted (we might as well have a fixed list of file extensions as was suggested in the comments for #46020)
Updated by Helmut Hummel almost 12 years ago
Andreas Wolf wrote:
When no library is available for doing mime type detection, information like the dimensions of images is not indexed. This leads to several problems e.g. in the frontend output.
To better cope with such a situation, we should have
- a reports module that tests if mime type detection works
- a heuristic that tries to guess the file type if no mime type can be extracted (we might as well have a fixed list of file extensions as was suggested in the comments for #46020)
- A Hook (or signal) for the mime type detection, as it might be useful to set mime types for "own" file suffixes.
Updated by Mathias Schreiber about 10 years ago
- Sprint Focus set to On Location Sprint
Updated by Frans Saris about 10 years ago
A signal should be added to LocalDriver::getMimeTypeOfFile()
Something like:
/** * Get MIME type of file. * * @param string $absoluteFilePath Absolute path to file * @return string|boolean MIME type. eg, text/html, FALSE on error */ protected function getMimeTypeOfFile($absoluteFilePath) { $mimeType = FALSE; if (function_exists('finfo_file')) { $fileInfo = new \finfo(); $mimeType = $fileInfo->file($absoluteFilePath, FILEINFO_MIME_TYPE); } elseif (function_exists('mime_content_type')) { $mimeType = mime_content_type($absoluteFilePath); } $this->emitGetMimeTypeOfFileSignal($absoluteFilePath, $mimeType); return $mimeType; } /** * @param $absoluteFilePath * @param $mimeType */ protected function emitGetMimeTypeOfFileSignal($absoluteFilePath, &$mimeType) { $this->signalSlotDispatcher->dispatch(self::class, self::SIGNAL_GetMimeTypeOfFile, array($this, $absoluteFilePath, $mimeType)); }
Updated by Mathias Schreiber about 10 years ago
- Status changed from Accepted to New
Updated by Frans Saris about 10 years ago
- Status changed from New to In Progress
Updated by Gerrit Code Review about 10 years ago
- Status changed from In Progress to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36358
Updated by Gerrit Code Review about 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36358
Updated by Mathias Schreiber about 10 years ago
- Status changed from Under Review to Closed
Updated by Anja Leichsenring about 9 years ago
- Sprint Focus deleted (
On Location Sprint)