[BUGFIX] Extract width and height meta data for all image files 77/65277/2
authorHelmut Hummel <typo3@helhum.io>
Mon, 10 Aug 2020 18:29:28 +0000 (20:29 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Fri, 14 Aug 2020 06:38:02 +0000 (08:38 +0200)
Instead of looking at the mime type of the file, the configured
image file extensions is checked to decide whether to extract
width and height for sys_file_metadata.

This allows pdf files to have their width and height to be extracted.

While the exact pixel values do not matter much for a PDF,
the ratio of width and height (landscape or portrait or even square)
can be very useful to "know".

Releases: master, 10.4, 9.5
Resolves: #91967
Change-Id: I354be4f07edf6e4c3b59748ccb87b67dd66caa8e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65277
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Tim Schreiner <schreiner.tim@gmail.com>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Simon Praetorius <simon@praetorius.me>
Reviewed-by: Tim Schreiner <schreiner.tim@gmail.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Classes/Resource/Index/Indexer.php

index 4a42f79..c9a156f 100644 (file)
@@ -290,7 +290,7 @@ class Indexer implements LoggerAwareInterface
 
         // since the core desperately needs image sizes in metadata table do this manually
         // prevent doing this for remote storages, remote storages must provide the data with extractors
-        if ($fileObject->getType() === File::FILETYPE_IMAGE && $this->storage->getDriverType() === 'Local') {
+        if ($fileObject->isImage() && $this->storage->getDriverType() === 'Local') {
             $rawFileLocation = $fileObject->getForLocalProcessing(false);
             $imageInfo = GeneralUtility::makeInstance(ImageInfo::class, $rawFileLocation);
             $metaData = [