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:
- Continue to accept stream wrapper URIs as before
- 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
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:
- 3571588-
changes, plain diff MR !77
- 3571588-support-local-file
compare
Comments
Comment #2
lauriiiComment #5
anybodyPlease 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!