Project

General

Profile

Actions

Bug #96529

closed

Filereference: no "width" and "height" properties if image from Initialisation Folder

Added by Lukas Hausammann over 2 years ago. Updated 3 months ago.

Status:
Rejected
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2022-01-13
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If you copy images via your extension into the fileadmin via /typo3conf/ext/my_ext/Initialisation/Files, the meta data "width" and "height" are empty. See screenshot attached.

If I then manually upload the image again via Filelist, then "width" and "height" are correct.


Files

Screenshot (28).png (14.7 KB) Screenshot (28).png Lukas Hausammann, 2022-01-13 13:47
FileReference-getProperty.diff (1.21 KB) FileReference-getProperty.diff David Bruchmann, 2023-03-07 09:18
Actions #1

Updated by Oliver Hader over 2 years ago

  • Status changed from New to Needs Feedback

Can you please mention which extension has been imported and which version?
To which imported file/path does the screenshot relate?

Thanks in advance for your feedback, this makes it easier to actually reproduce the behavior locally.

Actions #2

Updated by Lukas Hausammann over 2 years ago

Its my own sitepackage extension which is structured as a distribution as described here:
[[https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ExtensionArchitecture/CreateNewDistribution/Index.html#fileadmin-files]]

Actions #3

Updated by David Bruchmann over 1 year ago

I just had the same issue with TYPO3 version 11.5.24.
I changed \TYPO3\CMS\Core\Resource\FileReference for it, this is my version of the according method:


    public function getProperty($key)
    {
        $properties = $this->getProperties();
        if (!$this->hasProperty($key)) {
            if (
                in_array($key, ['width', 'height'])
                && $this->originalFile->isImage()
                && $this->originalFile->getStorage()->getDriverType() === 'Local'
            ) {
                $rawFileLocation = $this->originalFile->getForLocalProcessing(false);
                $imageInfo = GeneralUtility::makeInstance(ImageInfo::class, $rawFileLocation);
                $missingInfo = $imageInfo->{'get' . ucFirst($key)}();
                if ($missingInfo) {
                    return $missingInfo;
                } else {
                    throw new \InvalidArgumentException('Value for property "' . $key . '" could not be determined.', 1678113486);
                }
            } else {
                throw new \InvalidArgumentException('Property "' . $key . '" was not found in file reference or original file.', 1314226805);
            }
        }
        return $properties[$key];
    }

Actually the call is coming from the ...\DataProcessing\GalleryProcessor, so it might perhaps better to fix it there, but I never looked deeper in it.

Actions #5

Updated by Jonas Götze over 1 year ago

Had the same issue with TYPO3 11.5.27 after importing files with ext:migration. Running the scheduler FileStorageIndexingTask solved the issue, as it created the missing metadata-records.

Actions #6

Updated by Stefan Bürk 3 months ago

The code importing the file to the fileadmin must use proper FileAbstractionLayer API
and also enforce metadata retrieval/update on it, like it is done on a file upload. If
that is missing, the scheduler task will fix it (if it is executed in that system).

Actions #7

Updated by Georg Ringer 3 months ago

  • Status changed from Needs Feedback to Rejected

closing the issue as proper API or tasks to update metadata must be used

Actions

Also available in: Atom PDF