function MediaBrightcoveStreamWrapper::getLocalThumbnailPath in Brightcove Video Connect 7.3
Get the local thumbnail path of the bc video.
Return value
string The local path of the thumbnail image.
File
- brightcove_media/
MediaBrightcoveStreamWrapper.inc, line 73 - Stream wrapper fro Brightcove videos.
Class
- MediaBrightcoveStreamWrapper
- @file Stream wrapper fro Brightcove videos.
Code
function getLocalThumbnailPath() {
$video_id = $this
->getVideoID();
$thumbnail_path = 'public://media-brightcove/' . $video_id . '.jpg';
$default_path = 'public://media-brightcove/default.jpg';
if (!file_exists($thumbnail_path)) {
$dirname = drupal_dirname($thumbnail_path);
file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
$original_path = $this
->getOriginalThumbnailPath();
// If a thumbnail can be identified, download it.
if (!empty($original_path)) {
$response = drupal_http_request($original_path);
if (!empty($response->data)) {
file_unmanaged_save_data($response->data, $thumbnail_path, FILE_EXISTS_ERROR);
}
}
else {
if (!file_exists($default_path)) {
$bc_default_thumbnail = variable_get('brightcove_default_thumbnail', brightcove_get_default_image());
$args = new StdClass();
$args->filemime = $this
->getMimeType(NULL);
file_unmanaged_copy(file_icon_path($args, $bc_default_thumbnail), $default_path, FILE_EXISTS_ERROR);
}
return $default_path;
}
}
return $thumbnail_path;
}