1 image.module image_style_load($name = NULL, $include = NULL)

Load a style by style name or ID. May be used as a loader for menu items.

Parameters

$name: The name of the style.

$include: If set, this loader will restrict to a specific type of image style, may be one of the defined Image style storage constants.

Return value

An image style array containing the following keys::

  • "name": The unique image style name.
  • "effects": An array of image effects within this image style.

If the image style name is not valid, an empty array is returned.

See also

image_effect_load()

File

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

Code

function image_style_load($name = NULL, $include = NULL) {
  $styles = image_styles();

  // If retrieving by name.
  if (isset($name) && isset($styles[$name])) {
    $style = $styles[$name];
  }

  // Restrict to the specific type of flag. This bitwise operation basically
  // states "if the storage is X, then allow".
  if (isset($style) && (!is_numeric($include) || ($style['storage'] & (int) $include))) {
    return $style;
  }

  // Otherwise the style was not found.
  return FALSE;
}