function MediaYouTubeStreamWrapper::getLocalThumbnailPath in Media: YouTube 7
Same name and namespace in other branches
- 7.3 includes/MediaYouTubeStreamWrapper.inc \MediaYouTubeStreamWrapper::getLocalThumbnailPath()
- 7.2 includes/MediaYouTubeStreamWrapper.inc \MediaYouTubeStreamWrapper::getLocalThumbnailPath()
File
- includes/
MediaYouTubeStreamWrapper.inc, line 28 - Create a YouTube Stream Wrapper class for the Media/Resource module.
Class
- MediaYouTubeStreamWrapper
- Create an instance like this: $youtube = new ResourceYouTubeStreamWrapper('youtube://?v=[video-code]');
Code
function getLocalThumbnailPath() {
$parts = $this
->get_parameters();
$local_path = 'public://media-youtube/' . check_plain($parts['v']) . '.jpg';
if (!file_exists($local_path)) {
$dirname = drupal_dirname($local_path);
file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
@copy($this
->getOriginalThumbnailPath(), $local_path);
}
return $local_path;
}