diff --git a/bamboo_twig_loader/src/TwigExtension/Render.php b/bamboo_twig_loader/src/TwigExtension/Render.php index c1627df..e8d9ef8 100644 --- a/bamboo_twig_loader/src/TwigExtension/Render.php +++ b/bamboo_twig_loader/src/TwigExtension/Render.php @@ -165,11 +165,17 @@ class Render extends TwigExtensionBase { // Lazy load the fso. $fso = $this->getFileSystemObject(); - // Assert the image exist on the file system. - $image_path = $fso->realpath($image->getSource()); - - if (!is_file($image_path)) { - return NULL; + $moduleHandler = \Drupal::service('module_handler'); + // Check if Stage File Proxy is installed. If it is, then we don't need to + // worry about checking if the image exists on the file system, because + // Stage File Proxy will handle retrieving it for us. + if (!$moduleHandler->moduleExists('stage_file_proxy')){ + // Assert the image exists on the file system. + $image_path = $fso->realpath($image->getSource()); + + if (!is_file($image_path)) { + return NULL; + } } // When user want to preprocess the derivated instead of waiting first