You are here

function express_get_node_thumbnail in Express 7.2

Returns the image style url, image style uri, and image info for a given node/field.

File

./express.profile, line 208
Configure Express.

Code

function express_get_node_thumbnail($node, $field, $image_style = 'medium') {
  $node_field = $node->{$field};
  if (!empty($node_field)) {
    $image['alt'] = $node_field[LANGUAGE_NONE][0]['alt'];
    $image['path'] = image_style_url($image_style, $node_field[LANGUAGE_NONE][0]['uri']);
    $image['uri'] = image_style_path($image_style, $node_field[LANGUAGE_NONE][0]['uri']);
    if (!file_exists($image['uri'])) {
      image_style_create_derivative(image_style_load('medium'), $node_field[LANGUAGE_NONE][0]['uri'], $image['uri']);
    }
    $image['info'] = image_get_info($image['uri']);
  }
  return $image;
}