bamboo_render_image_style is incompatible with the Stage File Proxy module

Created on 4 April 2019, over 5 years ago
Updated 3 September 2024, 4 months ago

Hi,

Thank you Antistatique and its staff for this really useful module.

I've encountered an issue with using bamboo_render_image_style with the Stage File Proxy β†’ contrib module.

Stage File Proxy is a general solution for getting production files on a development server on demand. It saves you time and disk space by sending requests to your development environment's files directory to the production environment and making a copy of the production file in your development site. You should not need to enable this module in production.

Normally, with Stage File Proxy enabled, if I try and add an image to a page using file_url(image_uri) for example, and that image doesn't exist on the local file system (because I have imported a database dump from the production site) then a URL will be returned, and when a user requests that URL Stage File Proxy will catch the request and retrieve the image from my production site, so that the user sees an image even though it doesn't exist on that development environment.

If I use bamboo_render_image_style(image_uri, 'style_name') however, no URL is returned, so Stage File Proxy doesn't have a chance to catch the request and retrieve the image.

The problematic section is this part of bamboo_twig_loader/src/TwigExtension/Render.php:

    // Assert the image exist on the file system.
    $image_path = $fso->realpath($image->getSource());

    if (!is_file($image_path) && ) {
      return NULL;
    }

I'm going to attach a basic patch which seems to have resolved the issue for me.

πŸ“Œ Task
Status

Needs work

Version

4.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom Phil Wolstenholme

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.

Production build 0.71.5 2024