You are here

function brightcove_media_file_formatter_image_view in Brightcove Video Connect 7.3

Same name and namespace in other branches
  1. 7.7 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()
  2. 7.2 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()
  3. 7.4 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()
  4. 7.6 brightcove_media/brightcove_media.module \brightcove_media_file_formatter_image_view()

The brightcove_media_image file formatter view callback.

Parameters

$file:

$display:

$langcode:

Return value

array|null

1 string reference to 'brightcove_media_file_formatter_image_view'
brightcove_media_file_formatter_info in brightcove_media/brightcove_media.module
Implements hook_file_formatter_info().

File

brightcove_media/brightcove_media.module, line 140

Code

function brightcove_media_file_formatter_image_view($file, $display, $langcode) {
  $scheme = file_uri_scheme($file->uri);
  if (in_array($scheme, array(
    'brightcove',
    'brightcove-playlist',
  ))) {
    $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
    $image_style = $display['settings']['image_style'];
    $valid_image_styles = image_style_options(FALSE);
    if (empty($image_style) || !isset($valid_image_styles[$image_style])) {
      $element = array(
        '#theme' => 'image',
        '#path' => $wrapper
          ->getLocalThumbnailPath(),
        '#attributes' => isset($file->override['attributes']) ? $file->override['attributes'] : array(),
      );
    }
    else {
      $element = array(
        '#theme' => 'image_style',
        '#style_name' => $image_style,
        '#path' => $wrapper
          ->getLocalThumbnailPath(),
        '#attributes' => isset($file->override['attributes']) ? $file->override['attributes'] : array(),
      );
    }
    return $element;
  }
  return NULL;
}