Issue Bug Closed

#93407No thumbnail generation of .pdf in filelist if not present in [GFX][imagefile_ext]

Claus Harup 02/02/21, 08:31 updated 07/09/21, 20:15

Description

If I do not want my clients to choose .pdf documents as images in i.e. “text with image” I simply remove .pdf from [GFX][imagefile_ext] – that works!!!
But the negative side effect is that there will be no thumbnail generation of .pdf files in the filelist – see attached image :-(

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.

Files 1

History 4

  1. Christoph Lehmann commented 02/02/21, 19:48

    You can restrict possible file extensions per field and content element in TCA, see:

    https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Fal/UsingFal/Tca.html#tca-definition

    There you can replace $GLOBALS[‘TYPO3_CONF_VARS’][‘GFX’][‘imagefile_ext’] with your list of allowed file extensions.

    —-

    [GFX][imagefile_ext] is the central setting which defines which file extensions are images file extensions and thus which files can be used for thumbnail generation, etc.

  2. Claus Harup commented 02/03/21, 08:03

    I know I can restrict file extensions, but i.e. $GLOBALS[‘TCA’][‘tt_content’][‘image’][‘config’] is using [GFX][imagefile_ext] and that ‘s core generated….
    Wouldn’t it be smart to simply add the .pdf extension to the thumbnail generation regardless of the content of [GFX][imagefile_ext]?

  3. Claus Harup commented 02/04/21, 16:41

    Update:

    I added this to AdditionalConfiguration.php

    if (TYPO3_MODE === 'BE') {
        /*
         * This is done due to the fact that if ['GFX']['imagefile_ext'] does not contain 'pdf' no thumbnail generation
         * for pdf files is carried out...
         */
    
        $addExtension = 'pdf';
    
        if (!GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $addExtension)) {
            $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] .= ',' . $addExtension;
        }
    }

    …. it works like a charm :-)

  4. Oliver Bartsch commented and changed status New Closed 07/09/21, 20:15

    Hi, I’m a bit curios since pdf is defined by default, see https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.27/typo3/sysext/core/Configuration/DefaultConfiguration.php#L29. However, since you’ve already solved it for you and nobody else is reporting similar problems here, I’ll close this issue now. If you think this is the wrong decision or experience the issue again, please either reopen it or create a new issue, referencing this one.