function media_23video_file_formatter_image_view in Media 23video 7
Implements hook_file_formatter_FORMATTER_view().
File
- ./
media_23video.module, line 129 - 23Video service for Media.
Code
function media_23video_file_formatter_image_view(\stdClass $file, array $display, $langcode) {
if (MEDIA_23VIDEO_SERVICE == file_uri_scheme($file->uri)) {
$element = array();
$image_style = $display['settings']['image_style'];
$image_styles = image_style_options(FALSE);
$element['#path'] = file_stream_wrapper_get_instance_by_uri($file->uri)
->getLocalThumbnailPath();
$element['#alt'] = isset($file->override['attributes']['alt']) ? $file->override['attributes']['alt'] : $file->filename;
if (empty($image_styles[$image_style])) {
$element = array(
'#theme' => 'image',
);
}
else {
$element = array(
'#theme' => 'image_style',
'#style_name' => $image_style,
);
}
return $element;
}
return NULL;
}