function theme_video_thumbnails in Video 6.4
Same name and namespace in other branches
- 6.5 video.theme.inc \theme_video_thumbnails()
@file Theme functions for the video module.
1 theme call to theme_video_thumbnails()
- video_thumb_process in ./
video_widget.inc - Utility function that will add a preview of thumbnails for you to select when uploading videos.
File
- ./
video.theme.inc, line 9 - Theme functions for the video module.
Code
function theme_video_thumbnails($file, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
$file = (array) $file;
// return $file['filepath'];
if (!is_file($file['filepath'])) {
return '<!-- File not found: ' . $file['filepath'] . ' -->';
}
if ($getsize) {
// Use cached width and height if available.
if (!empty($file['data']['width']) && !empty($file['data']['height'])) {
$attributes['width'] = $file['data']['width'];
$attributes['height'] = $file['data']['height'];
}
elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) {
$attributes['width'] = $width;
$attributes['height'] = $height;
}
}
if (!empty($title)) {
$attributes['title'] = $title;
}
// Alt text should be added even if it is an empty string.
$attributes['alt'] = $alt;
// Add a timestamp to the URL to ensure it is immediately updated after editing.
$query_string = '';
if (isset($file['timestamp'])) {
$query_character = variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0' ? '&' : '?';
$query_string = $query_character . $file['timestamp'];
}
$attributes['src'] = file_create_url($file['filepath']) . $query_string;
$attributes = drupal_attributes($attributes);
return '<span></span><img ' . $attributes . ' />';
}