You are here

function image_style_transform_dimensions in Drupal 7

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.

1 call to image_style_transform_dimensions()
theme_image_style in modules/image/image.module
Returns HTML for an image using a specific image style.

File

modules/image/image.module, line 953
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 = image_style_load($style_name);
  if (!is_array($style)) {
    return;
  }
  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;
    }
  }
}