Bug #96529
closedFilereference: no "width" and "height" properties if image from Initialisation Folder
0%
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
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.
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]]
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.
Updated by David Bruchmann over 1 year ago
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.
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).
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