You are here

function webform_preprocess_image in Webform 6.x

Same name and namespace in other branches
  1. 8.5 includes/webform.theme.inc \webform_preprocess_image()

Implements hook_preprocess_image() for image templates.

Make sure the image src for the 'webform_image_file' src is an absolute URL.

File

includes/webform.theme.inc, line 698
Theme hooks, preprocessor, and suggestions.

Code

function webform_preprocess_image(&$variables) {
  global $base_url;
  if (isset($variables['attributes']['class']) && in_array('webform-image-file', (array) $variables['attributes']['class'])) {
    $variables['attributes']['src'] = $base_url . preg_replace('/^' . preg_quote(base_path(), '/') . '/', '/', $variables['attributes']['src']);
  }
}