1 image.module image_preprocess_image_style(&$variables)

Preprocess function for theme_image_style().

If theme_image_style() is called without setting explicit height/width for an SVG image, attempt to set those dimensions. This helps in particular when uploading an image for the first time in a content form.

File

core/modules/image/image.module, line 1364
Exposes global functionality for creating image styles.

Code

function image_preprocess_image_style(&$variables) {
  $uri = $variables['uri'];
  // Only try to get file information if $uri is not empty.
  if (!empty($uri) && image_is_svg($uri)) {
    $original = array(
      'width' => $variables['width'],
      'height' => $variables['height'],
    );
    image_style_transform_dimensions($variables['style_name'], $original);
  }
}