You are here

function theme_brightcove_media_image in Brightcove Video Connect 7.4

The brightcove_media_image file formatter theme function.

Parameters

$variables:

Return value

null

1 theme call to theme_brightcove_media_image()
brightcove_media_file_formatter_image_view in brightcove_media/brightcove_media.module
The brightcove_media_image file formatter view callback.

File

brightcove_media/brightcove_media.module, line 259
This module provide the hook implementations for the integration with Media module.

Code

function theme_brightcove_media_image($variables) {
  $output = NULL;
  $elements = $variables['elements'];
  $image_type = isset($variables['#brightcove_image_type']) ? $elements['#brightcove_image_type'] : 'thumbnailURL';
  $image_style = isset($elements['#brightcove_image_style']) ? $elements['#brightcove_image_style'] : 'thumbnail';
  if (isset($elements['#video'])) {
    $destination = NULL;
    if (isset($elements['#video']->{$image_type})) {
      $destination = brightcove_remote_image($elements['#video']->{$image_type});
    }
    else {
      $destination = brightcove_get_default_image();
    }
    $styled_path = image_style_path($image_style, $destination);
    $style = image_style_load($image_style);
    image_style_create_derivative($style, $destination, $styled_path);
    $output = theme('image', array(
      'path' => $styled_path,
    ));
  }
  return $output;
}