You are here

function bynder_file_formatter_image_view in Bynder 7

Format image view.

1 string reference to 'bynder_file_formatter_image_view'
bynder_file_formatter_info_alter in includes/bynder.formatters.inc
Implements hook_file_formatter_info(). $info: Array of information on file formatters exposed by hook_file_formatter_info() implementations.

File

includes/bynder.formatters.inc, line 36
bynder/includes/bynder.formatters.inc Formatters for Media: Bynder.

Code

function bynder_file_formatter_image_view($file, $display, $langcode) {
  $scheme = file_uri_scheme($file->uri);
  if ($scheme == 'bynder') {
    $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
    $image_style = $display['settings']['image_style'];
    $element = array(
      '#theme' => 'image',
      '#path' => $wrapper
        ->getWebImagePath($image_style, $file->filename),
      '#style_name' => $image_style,
      '#alt' => isset($file->override['attributes']['alt']) ? $file->override['attributes']['alt'] : $file->filename,
    );
    return $element;
  }
}