Issue Bug Closed

#105557Image Processing check fails

wini2 no-lastname-given 11/07/24, 14:38 updated 01/08/25, 18:04

Description

Trying to check Image Processing capabilites, I get the error message

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: imageavif(): avif error – Could not encode image: No codec available in /home/www/mycms/vendor/typo3/cms-frontend/Classes/Imaging/GifBuilder.php line 2624

PHP Info shows AVIF Support enabled for imagick and GD
or console
php -i | grep AVIF -> AVIF Support => enabled

No matter if GraphicsMagick or ImageMagick is selected as Configuration Preset/ Installation-Wide Options -> ImageProcessing [GFX].

For v12 on same hosting package the test works fine – probably because of the newly avif-feauture of v13.

Reviews 0

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

Files 2

History 9

  1. Garvin Hicking commented and changed status New Needs Feedback <span data-processor="relativetime" data-value="2024-11-26T15:07:02+00:00" > 11/26/24, 15:07 </span>

    gdlib functionality of AVIF support can also depend on the installed encoder on system level. Specifically libavif-dev – see https://stackoverflow.com/questions/70398133/php8-1-how-do-i-get-imageavif-to-work for an example.

    Sadly this cannot be detected on the PHP level and only becomes apparent (with an error) when the conversion is tried.

    Did you check “Admin Tools > Environment > Image Processing > Create avif image with box from file” and see what it says there?

  2. wini2 no-lastname-given commented and changed attached config-preset.jpg attached image-processing-test-excerpt.jpg <span data-processor="relativetime" data-value="2025-01-06T16:31:09+00:00" > 01/06/25, 16:31 </span>

    Thanks for the hint, but I think the problem is somewhere else. After updating to 13.4.2, at least the Image Processing-modal shows up, but I get errors on every test. The Configuration Preset shows that gm was found. What I’m worried about is, than not even the referece-images are shown (although they are present in the typo3temp-folder). Maybe it has something to do with the Environment Status?
    -> Unexpected server response
    https://mydomain.de/typo3temp/assets/6e832424.tmp/af52f81b.php.wrong: unexpected content PHP content.

    Interestingly the problem is only with the test, the frontend and the backend are working as expected.

  3. Garvin Hicking commented <span data-processor="relativetime" data-value="2025-01-06T23:15:41+00:00" > 01/06/25, 23:15 </span>

    This could actually be a CSP and/or Ajax issue.

    The images are embedded base64 encoded and maybe blocked by the browser. What does the JS&error console say?

  4. wini2 no-lastname-given commented <span data-processor="relativetime" data-value="2025-01-07T13:50:34+00:00" > 01/07/25, 13:50 </span>

    Probably you’re right. No error-Messages in the BE-CSP-Module of TYPO3 but a lot in the Browser-Console.

    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/gif;base64,R0lGODlhAQABAIAAAA… blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” drag-tooltip.js:13:2420
    Das Öffnen mehrerer Popups wurde aufgrund fehlender Benutzeraktivierung blockiert. context-menu-actions.js:13:1073
    Diese Seite verwendet die nicht standardisierte Eigenschaft “zoom”. Stattdessen sollte calc() in den entsprechenden Eigenschaftswerten oder “transform” zusammen mit “transform-origin: 0 0” verwendet werden. install.php
    Content-Security-Policy: Die Einstellungen der Seite haben die Ausführung eines Inline-Skripts (script-src-elem) blockiert, da es gegen folgende Direktive verstößt: “script-src ‘self’ ‘nonce-JuhnBYMOX2-tGEjHncGugYezxWTT-ml_Vxv7eEITl3owAqWHgLFQaQ’” utils.js:33:10
    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/svg+xml,%3csvg xmlns=‘http://��� blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” 7 main
    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/gif;base64,R0lGODdhyAAyAOMAAP… blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” image-processing.js:13:2709
    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/gif;base64,R0lGODdhyAAyALMAAP… blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” image-processing.js:13:2709
    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/svg+xml,%3csvg xmlns=‘http://��� blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” 3 main
    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/jpg;base64,/9j/4AAQSkZJRgABAQ… blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” 6 image-processing.js:13:2709
    Content-Security-Policy: Die Einstellungen der Seite haben das Laden einer Ressource (img-src) auf data:image/gif;base64,R0lGODlhLAHhAPcAAA… blockiert, da sie gegen folgende Direktive verstößt: “default-src ‘self’ ‘unsafe-inline’” image-processing.js:13:2709

    …

    I had the supposition that it has something to with the Domain, so I tried [SYS][trustedHostsPattern] = ‘.*’ – without success. TYPO3 is running on a hosting-package and the domain is an additonal booked. Could it be, that is has something to do with that?

    I also tried to disable csp by adding active: false to a csp.ymal in my config/sites/main-directory – without changes.

  5. Garvin Hicking commented <span data-processor="relativetime" data-value="2025-01-07T22:55:39+00:00" > 01/07/25, 22:55 </span>

    Could you please check what exactly the TYPO3 backend reports as “Content-Security-Policy” HTTP header for the HTTP request of a backend page?

    By default it should be (line breaks for readability, some replacements with “…”:

    default-src 'self'; 
    script-src 'self' 'nonce-...' 'report-sample'; 
    style-src 'self' 'unsafe-inline' 'report-sample';
    style-src-attr 'unsafe-inline' 'report-sample'; 
    img-src 'self' data: *.ytimg.com *.vimeocdn.com https://extensions.typo3.org;
    worker-src 'self' blob:;
    frame-src 'self' *.youtube-nocookie.com *.youtube.com *.vimeo.com; 
    base-uri 'none'; 
    object-src 'none';
    report-uri https://ddev.site/typo3/@http-reporting?csp=report&requestTime=1736290026790821&requestHash=...

    the important part here is img-src 'self' data: *.ytimg.com *.vimeocdn.com https://extensions.typo3.org; – the ‘data:’ keyword needs to be present.

    My guess is that maybe either your Apache’s .htaccess might have interferring directives, or some extension has a ContentSecurityPolicies.php file with instructions for the Backend, or a PSR-14 event is used to mutate the policies.

    You can see the active mutations in “System > Configuration > Content Security Policy Mutations”, listed seperately for backend and frontend.

    For me, the rules stem from typo3/cms-backend and typo3/cms-extensionmanager in my development instance.

    Please note, the YAML file csp.yaml file for the Site Configuration is only applied for the frontend, not the backend. The backend does not run in a Site context, therefore no csp.yaml can be evaluated (to my knowledge). Check out https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentSecurityPolicy/Index.html for details.

    Hope that helps for further inspection :-)

  6. wini2 no-lastname-given commented <span data-processor="relativetime" data-value="2025-01-08T12:32:31+00:00" > 01/08/25, 12:32 </span>

    Thanks a lot!

    I could make it work. The fault was a leftover from before 13.4.2. I an act of desparation I added
    $GLOBALS[“TYPO3_CONF_VARS”][“BE”][“HTTP”][“Response”][“Headers”] += [“csp” => “Content-Security-Policy: default-src ‘self’ ‘unsafe-inline’ ‘unsafe-inline’”];
    to my additional.php (refer to https://www.sebkln.de/tutorials/http-security-header-teil-2-csp/).

    However, the initial error message (from brfore TYPO3 v13.4.2)

    (1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
    PHP Warning: imageavif(): avif error – Could not encode image: No codec available in /home/www/mycms/vendor/typo3/cms-frontend/Classes/Imaging/GifBuilder.php line 2624

    was gone too.

  7. Garvin Hicking commented <span data-processor="relativetime" data-value="2025-01-08T14:05:05+00:00" > 01/08/25, 14:05 </span>

    Great – am I assuming right that we can close the issue then?

  8. wini2 no-lastname-given commented <span data-processor="relativetime" data-value="2025-01-08T15:05:08+00:00" > 01/08/25, 15:05 </span>

    Yes, I would have done it, but I can’t find a button or something to do so.

  9. Garvin Hicking commented and changed status Needs Feedback Closed <span data-processor="relativetime" data-value="2025-01-08T18:04:15+00:00" > 01/08/25, 18:04 </span>

    All good then, one needs permissions. Closing and thanks for the quick responses!