function image_style_load
image_style_load($name = NULL, $isid = NULL, $include = NULL)
Loads a style by style name or ID.
May be used as a loader for menu items.
Parameters
$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.
Return value
An image style array containing the following keys:
- "isid": The unique image style ID.
- "name": The unique image style name.
- "effects": An array of image effects within this image style.
If the image style name or ID is not valid, an empty array is returned.
See also
File
- modules/image/image.module, line 641
- Exposes global functionality for creating image styles.
Code
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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!image!image.module/function/image_style_load/7.x