Loads a style by style name or ID.
May be used as a loader for menu items.
$name: The name of the style.
$isid: Optional. The numeric id of a style if the name is not known.
$include: If set, this loader will restrict to a specific type of image style, may be one of the defined Image style storage constants.
An image style array containing the following keys:
If the image style name or ID is not valid, an empty array is returned.
function image_style_load($name = NULL, $isid = NULL, $include = NULL) {
$styles = image_styles();
// If retrieving by name.
if (isset($name) && isset($styles[$name])) {
$style = $styles[$name];
}
// If retrieving by image style id.
if (!isset($name) && isset($isid)) {
foreach ($styles as $name => $database_style) {
if (isset($database_style['isid']) && $database_style['isid'] == $isid) {
$style = $database_style;
break;
}
}
}
// Restrict to the specific type of flag. This bitwise operation basically
// states "if the storage is X, then allow".
if (isset($style) && (!isset($include) || $style['storage'] & (int) $include)) {
return $style;
}
// Otherwise the style was not found.
return FALSE;
}