Derivatives images not generated

Created on 1 March 2022, over 2 years ago
Updated 20 August 2024, 3 months ago

Problem/Motivation

When an image in a defined style is added to the content of the page, not in background, and the derivatives images are flushed, when we visit the page, the derivatives images are not generated.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France bessonweb

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • I ran into this same issue. We made updates to the images styles to convert to webp, once the image cache was flushed, all images added through gutenberg show up as broken images. Since we have thousands of pages, we were unable to make this update to improve site performance due to the limitations of gutenberg to handle this update.

    Any help would be greatly appreciated!

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    The problem arises with all blocks, that store the full image derivative path including `?itok` parameter in the body text.

    So whenever images style derivatives are not existing (flushed, or not existing because of different environments) they need to be regenerated. This is been done by the `itok` parameter verification for DDOS protection. If your environments have different hashes, the itok will be different and the image generation would fail.

    The same problem arises when you use the `Convert` image style action. If you convert to another file type, the corresponding image URL needs to change (but also the itok, will be different). That's the reason that after enabling the `webp` conversion and flushed image styles, the the image path is wrong in the body text and will result in a 404 (not generated image).

    There are only two workarounds for this problem:
    1. Re-select the image - the image url will be updated
    2. Add a Gutenberg BlockProcessor or Text Filter that takes the file uuid, regenerates the image style URL and replaces it in the text

    This problem might become more prominent, when people start adding `webp` conversion actions after it went into Drupal Core in 10.3

  • πŸ‡ΊπŸ‡ΈUnited States loze Los Angeles

    I have a MR for version 3.0 that I think addresses this issue. It adds an image block processor that generates the derivative on the front end. In my case I needed this because the path stored in gutenberg did not reflect the correct path when using the s3fs or cdn modules. ✨ Add an imageBlockProcessor so core/image blocks can support cdn and s3f modules Needs review

  • Worth noting that this also causes stage_file_proxy not to load the image at all as long as it was used within the core/image block. Media works fine.

  • πŸ‡©πŸ‡ͺGermany szeidler Berlin

    Thanks for your input @loze. Those issues are actually closely related, because both require a on-the-fly rewrite of the stored image paths.

    I actually have a similar patch to yours, that supports `core/image`, `core/gallery` and `core/media-text`. Should I add it as a separate merge request to your issue @loze, so that you can have a look and see where to continue.

  • Can we get this fixed on 2.x and 3.x? seems rather high priority IMO

Production build 0.71.5 2024