Skip to content

Commit

Permalink
[BUGFIX] Extract width and height meta data for all image files
Browse files Browse the repository at this point in the history
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/+/65323
Tested-by: Helmut Hummel <typo3@helhum.io>
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Helmut Hummel <typo3@helhum.io>
  • Loading branch information
helhum committed Aug 14, 2020
1 parent 2e2ac3c commit 1dc0cba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Resource/Index/Indexer.php
Expand Up @@ -302,7 +302,7 @@ protected function extractRequiredMetaData(File $fileObject)
{
// 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 ($this->storage->getDriverType() === 'Local' && GeneralUtility::inList(strtolower($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ?? ''), $fileObject->getExtension())) {
$rawFileLocation = $fileObject->getForLocalProcessing(false);
$imageInfo = GeneralUtility::makeInstance(ImageInfo::class, $rawFileLocation);
$metaData = [
Expand Down

0 comments on commit 1dc0cba

Please sign in to comment.