You are here

public function Media23VideoStreamWrapper::getLocalThumbnailPath in Media 23video 7

Get the local video thumbnail.

Return value

string Local path to video thumbnail.

File

includes/Media23VideoStreamWrapper.inc, line 64
Definition of Media23VideoStreamWrapper object.

Class

Media23VideoStreamWrapper
Class Media23VideoStreamWrapper.

Code

public function getLocalThumbnailPath() {
  $parameters = $this
    ->get_parameters();

  // There's no need to hide thumbnails, always use the public system rather
  // than file_default_scheme().
  $dir = 'public://' . MEDIA_23VIDEO_SERVICE;
  $path = "{$dir}/" . check_plain($parameters['v']) . '.jpg';
  if (!file_exists($path) && file_prepare_directory($dir, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
    $path = file_unmanaged_save_data(file_get_contents($this
      ->getOriginalThumbnailPath()), $path);
  }
  return empty($path) ? '' : $path;
}