function image_style_load
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
12 calls to image_style_load()
- ImageAdminStylesUnitTest::testDefaultStyle in modules/
image/ image.test - Test to override, edit, then revert a style.
- ImageAdminStylesUnitTest::testStyle in modules/
image/ image.test - General test to add a style, add/remove/edit effects to it, then delete it.
- ImageAdminUiTestCase::testEditEffectHelpText in modules/
image/ image.test - Test if the help text is available on the edit effect form.
- ImageFileMoveTest::testNormal in modules/
simpletest/ tests/ image.test - Tests moving a randomly generated image.
- ImageStyleFlushTest::testFlush in modules/
image/ image.test - General test to flush a style.
1 string reference to 'image_style_load'
- image_style_form in modules/
image/ image.admin.inc - Form builder; Edit an image style name and effects order.
File
-
modules/
image/ image.module, line 651
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.