Problem/Motivation

The image_style filter currently only accepts stream wrapper URIs (e.g., public://image.jpg) as input. However, in many contexts, especially when working with SDCs and Canvas, image sources may be provided as local file URLs (e.g., /sites/default/files/image.jpg) rather than stream wrapper URIs.

This limitation makes it difficult to apply image styles to images that come from sources that provide URLs rather than URIs.

Steps to reproduce

Try to apply an image style to a local file URL: {{ '/sites/default/files/image.jpg'|image_style('thumbnail') }}

The filter fails because it doesn't recognize the local file URL format.

Proposed resolution

Change the image_style filter to:

  1. Continue to accept stream wrapper URIs as before
  2. Also accept local file URLs (e.g., /sites/default/files/image.jpg) by converting them to stream wrapper URIs internally before applying the style

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork twig_tweak-3571588

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lauriii created an issue. See original summary.

lauriii’s picture

Version: 4.x-dev » 3.x-dev

lauriii changed the visibility of the branch 3571588-support-local-file to hidden.

anybody’s picture

Version: 3.x-dev » 4.x-dev

Please check if this is still relevant and use 4.x as target branch for Merge-Requests (MR) as that's the new development branch. Thanks!