ImageEffects of the same image style should be able to pass variables between them

Created on 29 October 2012, over 11 years ago
Updated 30 January 2023, over 1 year ago

Problem/Motivation

At the moment it is possible to set/getThirdPartySettings on the image style, but the effects that are part of that style do not have any visibility on them. There are use cases where a setting at the ImageStyle level should be accessed by its ImageEffects. Also, there are cases where one effect in the sequence needs to hand over some setting to an effect coming later in the sequence.

Examples:

Proposed resolution

Introduce an ImageEffectWithRuntimeVariablesInterface and trait so that effects that need to access the parent ImageStyle can do so, and can also set arbitary 'runtime variables' that can be accessed by further effects, and whose scope is limited within the execution of a ImageStyle::createDerivative, ::transformDimensions, or ::getDerivativeExtension call. Change the ImageEffectPluginCollection so to inject the runtime variables and the image style id to relevant effect plugins on initialization.

Remaining tasks

User interface changes

None.

API changes

Introduce a new ImageEffectWithRuntimeVariablesInterface with relevant methods.

Beta phase evaluation

Original report by @zuuperman β†’

There are some use cases for effects, that require the style information to be given as argument to the effect callbacks. This is mostly the case when the effect settings can change per file.

For example: http://drupal.org/node/1250506#comment-4889248

The same goes for dimension callbacks, but i will update this in #1364670: ImageStyle::transformDimensions unable to deal with all effects. β†’

✨ Feature request
Status

Needs work

Version

10.1 ✨

Component
Image moduleΒ  β†’

Last updated 5 days ago

Created by

πŸ‡§πŸ‡ͺBelgium nils.destoop

Live updates comments and jobs are added and updated live.
  • Contributed project blocker

    It denotes an issue that prevents porting of a contributed project to the stable version of Drupal due to missing APIs, regressions, and so on.

  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

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.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.69.0 2024