I am using the following modules:
and would like to render a thumbnail of a Youtube video in a templa
One more example, which makes possible to render video thumbnail (vimeo, youtube, qbrick, etc.) with your custom image style.
$file
- File object that you can easily get from media field.
$wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
$image_uri = $wrapper->getLocalThumbnailPath();
$image_rendered = theme('image_style', array(
'style_name' => 'YOUR_IMAGE_STYLE_HERE',
'path' => $image_uri
));
Please note, that if you want to render also image, than you need to check $file->type
if it's video
or image
, because it will use different wrapper objects with different methods.