Warm images after image style flush

Created on 20 April 2023, over 1 year ago
Updated 21 June 2023, over 1 year ago

Problem/Motivation

After updating an image style or by running drush image:flush, image derivatives are deleted, but not warmed again.

Proposed resolution

Add a hook_image_style_flush implementation. If the image style is configured to warm immediately, use the batch service like the Drush command does. If the image style is configured to use a queue, create queue items.

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

  • Issue created by @dieterholvoet
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Not currently mergeable.
  • @dieterholvoet opened merge request.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    12 pass
  • Status changed to Needs review over 1 year ago
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    12 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    12 pass
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    12 pass
  • πŸ‡§πŸ‡ͺBelgium dieterholvoet Brussels

    I made the process more efficient when using queues. File entities are not being loaded anymore, queue items are being created for all files regardless of them passing validation since validation is being run during queue processing as well. This performance improvement is crucial when updating an image style that has thousands of derivatives, now the whole queueing process is near instant instead of taking 10 minutes or more in my case.

  • πŸ‡©πŸ‡ͺGermany IT-Cru Munich

    @DieterHolvoet: How we detect if an image style is edited or deleted? I think also delete triggers this hook, which is than a potential problem.

    I don't know if this will get into 8.x-1.2 release, but for 8.x-1.3 for sure.

  • πŸ‡ΊπŸ‡ΈUnited States recrit

    @IT-Cru: The hook_image_style_flush is called during ImageStyle::save() and ImageStyle::delete(). The MR 14 will be problematic in the following:
    - When the image style config is deleted.
    - When the image style config is imported during a deploy process. The MR 14 could trigger a new batch to run during the configuration import.

  • Status changed to Needs work over 1 year ago
  • πŸ‡©πŸ‡ͺGermany IT-Cru Munich

    Set to needs work, because I think we should think of possible problems which could be pop-up.

Production build 0.71.5 2024