public function video_helper::thumbnail_object in Video 6.5
Same name and namespace in other branches
- 6.4 includes/video_helper.inc \video_helper::thumbnail_object()
- 7 includes/video_helper.inc \video_helper::thumbnail_object()
1 call to video_helper::thumbnail_object()
- video_helper::video_object in includes/video_helper.inc
File
- includes/video_helper.inc, line 76
Class
- video_helper
Code
public function thumbnail_object($element) {
$field = content_fields($element['#field_name'], $element['#type_name']);
$thumbnail = new stdClass();
$thumbnail->filepath = '';
$thumbnail->url = '';
$thumbnail->alt = '';
$thumbnail->title = '';
$thumbnail->description = '';
$use_default_img = isset($element['#item']['data']['use_default_video_thumb']) ? $element['#item']['data']['use_default_video_thumb'] : FALSE;
if ($use_default_img && !empty($field['widget']['default_video_thumb']['filepath'])) {
$thumbnail->filepath = $field['widget']['default_video_thumb']['filepath'];
}
elseif (isset($element['#item']['data']['video_thumb']) ? $element['#item']['data']['video_thumb'] : FALSE) {
$thumbnail->filepath = $element['#item']['data']['video_thumb'];
}
else {
}
if (isset($element['imagecache_preset'])) {
$thumbnail->url = imagecache_create_url($element['imagecache_preset'], $thumbnail->filepath);
$thumbnail->filepath = imagecache_create_path($element['imagecache_preset'], $thumbnail->filepath);
}
else {
$thumbnail->url = file_create_url($thumbnail->filepath);
}
$thumbnail->swfthumb = $thumbnail->filepath;
$thumbnail->filemime = file_get_mimetype($thumbnail->filepath);
return $thumbnail;
}