function image_style_transform_dimensions

Determines the dimensions of the styled image.

Applies all of an image style's effects to $dimensions.

Parameters

$style_name: The name of the style to be applied.

$dimensions: Dimensions to be modified - an array with components width and height, in pixels.

2 calls to image_style_transform_dimensions()
picture_get_image_dimensions in drupal/core/modules/picture/picture.module
Determines the dimensions of an image.
theme_image_style in drupal/core/modules/image/image.module
Returns HTML for an image using a specific image style.

File

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

Code

function image_style_transform_dimensions($style_name, array &$dimensions) {
  module_load_include('inc', 'image', 'image.effects');
  $style = entity_load('image_style', $style_name);
  if (!empty($style->effects)) {
    foreach ($style->effects as $effect) {
      if (isset($effect['dimensions passthrough'])) {
        continue;
      }
      if (isset($effect['dimensions callback'])) {
        $effect['dimensions callback']($dimensions, $effect['data']);
      }
      else {
        $dimensions['width'] = $dimensions['height'] = NULL;
      }
    }
  }
}