This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get image settings array from a field on the node | |
$image = field_get_items('node', $node, 'INSERT_IMAGE_FIELD_MACHINE_NAME'); | |
// Picture settings | |
$picture_mapping = picture_mapping_load('INSERT_PICTURE_MAPPING_MACHINE_NAME'); | |
$fallback = 'INSERT_IMAGE_STYLE_MACHINE_NAME'; | |
$breakpoints = picture_get_mapping_breakpoints($picture_mapping, $fallback); | |
// Create a new variable to pass through to the node template | |
$variables['INSERT_NEW_VARIABLE_NAME_TO_PASS_TO_NODE_TEMPLATE'] = theme('picture', array('uri' => $image[0]['uri'], 'style_name' => $fallback, 'breakpoints' => $breakpoints)); |