Project

General

Profile

Actions

Bug #63519

closed

sys_file_processedfile rows contain zero dimensions

Added by Ralf Zimmermann over 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2014-12-02
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

There is an error with the scaling process if the same picture is placed multiple times on the same page.
Some rows from table sys_file_processedfile contain zero values for width and height although the serialized configuration contains settings for width and height.

The LocalDriver moves the temporary (scaled) file after scaling but the GraphicalFunctions (scaling process)
assumes (on the basis of a database query) at the next time that the temporary file exists and try to get the image dimensions on a not existing file.
Nothing is returned and a zero value reaches the Database.

...
\TYPO3\CMS\Core\Resource\Processing\LocalImageProcessor::processTask()
60: $helper = $this->getHelperByTaskName($task->getName());
62: $result = $helper->process($task);
\TYPO3\CMS\Core\Resource\Processing\LocalCropScaleMaskHelper::process()
75: $result = $gifBuilder->imageMagickConvert(
        $originalFileName,
        $configuration['fileExtension'],
        $configuration['width'],
        $configuration['height'],
        $configuration['additionalParameters'],
        $configuration['frame'],
        $options
    );
\TYPO3\CMS\Core\Imaging\GraphicalFunctions::imageMagickConvert()
2258: $output = $this->absPrefix . $this->tempPath . 'pics/' . $this->filenamePrefix . $theOutputName . '.' . $newExt;

$output contains the temporary filename like /var/www/basisbox.local/htdocs/typo3temp/pics/5e0e4724b9.jpg

\TYPO3\CMS\Core\Imaging\GraphicalFunctions::file_exists_typo3temp_file()
This function look into the database for a entry that contain the temporary filepath ($output).
If the entry exist no scaling will be performed because there is already an temporary file.

2261: if ($this->dontCheckForExistingTempFile || !$this->file_exists_typo3temp_file($output, $imagefile)) {
2262:   $this->imageMagickExec($imagefile, $output, $command, $frame);
2263: }
2264: if (file_exists($output)) {

After the file_exists_typo3temp_file() check, we check the existence of the temporary file again and return its dimensions.
If the file does not exist, nothing will be returned.

Back to the processTask

\TYPO3\CMS\Core\Resource\Processing\LocalImageProcessor::processTask()
73: $task->getTargetFile()->updateWithLocalFile($result['filePath']);

After the scaling the scaled file will be added to the storage
$result['filePath'] contain the temporary filepath eg. /var/www/basisbox.local/htdocs/typo3temp/pics/5e0e4724b9.jpg

\TYPO3\CMS\Core\Resource\ProcessedFile::updateWithLocalFile()
181: $addedFile = $this->storage->updateProcessedFile($filePath, $this);
\TYPO3\CMS\Core\Resource\ResourceStorage::updateProcessedFile()
1118: $fileIdentifier = $this->driver->addFile($localFilePath, $this->getProcessingFolder()->getIdentifier(), $processedFile->getName());
\TYPO3\CMS\Core\Resource\Driver\LocalDriver::addFile()
662: $result = rename($localFilePath, $targetPath);

At this point the temporary file /var/www/basisbox.local/htdocs/typo3temp/pics/5e0e4724b9.jpg will be moved to another location.
The next scaling process will fail because
\TYPO3\CMS\Core\Imaging\GraphicalFunctions::file_exists_typo3temp_file()
find a database record that contains this filename.
The process don't render the file again because
\TYPO3\CMS\Core\Imaging\GraphicalFunctions::imageMagickConvert()
2264: if (file_exists($output)) {
don't find the file and return nothing and the sys_file_processedfile row will be filled with height = 0 and width = 0


Related issues 3 (0 open3 closed)

Related to TYPO3 Core - Bug #62400: Lot of entries in sys_file_processed with name=NULL and identifier emptyRejectedAndreas Wolf2014-10-22

Actions
Related to TYPO3 Core - Task #64643: Remove feature enable_typo3temp_db_trackingClosedBenni Mack2015-01-30

Actions
Related to TYPO3 Core - Bug #65842: Cropping Images in GIFBUILDER is broken since TYPO3 CMS 6.2.10Closed2015-03-19

Actions
Actions

Also available in: Atom PDF