$query));
$player_title = t('Embedded video for @entity_title', array(
'@entity_title' => $variables['entity_title'],
));
$output = '';
if ($size == 'responsive') {
$output = '
' . $output . '
';
}
return $output;
}
/**
* Theme function for thumbnails.
*/
function theme_youtube_thumbnail($variables) {
$id = $variables['video_id'];
$style = $variables['image_style'];
// Get YouTube settings - TODO is this needed?
$size = variable_get('youtube_size', '420x315');
$dimensions = youtube_get_dimensions($size);
$files = variable_get('file_public_path', conf_path() . '/files');
$youtube = variable_get('youtube_thumb_dir', 'youtube');
$dest = $files . '/' . $youtube . '/' . $id . '.png';
// Check to see if a thumbnail exists locally.
if (!file_exists($dest)) {
// Retrieve the image from YouTube.
if (!youtube_get_remote_image($id)) {
// Use the remote source if local copy fails.
$src = youtube_build_remote_image_path($id);
return theme('image', array('path' => $src));
}
}
$alt = t('Embedded thumbnail for @entity_title', array(
'@entity_title' => $variables['entity_title'],
));
if ($style) {
$uri = 'public://' . $youtube . '/' . $id . '.png';
$image = theme('image_style', array(
'style_name' => $style,
'path' => $uri,
'alt' => $alt,
));
}
else {
$path = $files . '/' . $youtube . '/' . $id . '.png';
$image = theme('image', array('path' => $path, 'alt' => $alt));
}
// Check if an url path is provided
if ($variables['image_link'] != NULL) {
$url_path = $variables['image_link']['path'];
$options = $variables['image_link']['options'];
$image = l($image, $url_path, $options);
}
return $image;
}