Issue Bug Closed

#79301GIFBUILDER generates too long file names

Thomas Oliver Moll 01/12/17, 18:15 updated 10/02/18, 11:04

Description

Hi,

in commit [[https://github.com/TYPO3/TYPO3.CMS/commit/94e915fee3db6df4c43418d378101b400a113b69]] the generation for GIFBUILDER filenames was changed.

The Comment states, that the filePrefix should be limited to 100 characters.
The review [[https://review.typo3.org/#/c/34015/]] notices this but wants the comment to be removed.

I have a complicated GIFBULDER setup with lots of layers that are turned on and of by if statements.
Even the switched-off layers get serialized and produce a really long filename that can not be handled.

A simple modification of fileName() in GifBuilder.php does the Trick:

  public function fileName($pre)
    {
        /** @var $basicFileFunctions \TYPO3\CMS\Core\Utility\File\BasicFileUtility */
        $basicFileFunctions = GeneralUtility::makeInstance(BasicFileUtility::class);
        $filePrefix = implode('_', array_merge($this->combinedTextStrings, $this->combinedFileNames));
        $filePrefix = $basicFileFunctions->cleanFileName($filePrefix);

        /* shorten Prefix to avoid too long filenames */
        $filePrefix = substr($filePrefix,0,100);

        return $this->tempPath . $pre . $filePrefix . '_' . GeneralUtility::shortMD5(serialize($this->setup)) . '.' . $this->extension();
    }

IMHO, there should be an Option to set the Filename via TS. Or better to choose the filestore where it is stored.
I have TYPO3s with many websites in it. For every site there is a filestore. But when I annotate images via GIFBUILDER all the Images go into one directory (typo3temp) and not to the _processed folder of the filestore of the imagage that is annotated.

Reviews 2