You are here

public static function video_utility::createTemporaryLocalCopy in Video 7.2

1 call to video_utility::createTemporaryLocalCopy()
TranscoderAbstractionFactoryFfmpeg::setInput in transcoders/TranscoderAbstractionFactoryFfmpeg.inc
Set Input file to add input file in to settings variable

File

./video.utility.inc, line 162
This file will be used to keep all utility functions data structures.

Class

video_utility
Helper functions for the Video module.

Code

public static function createTemporaryLocalCopy($uri) {
  if (empty(self::$temporaryCopies)) {
    self::$temporaryCopies = array();
  }
  elseif (isset(self::$temporaryCopies[$uri])) {
    return self::$temporaryCopies[$uri];
  }

  // Try to fetch the file using http. This is much faster in the case of S3 via the Amazon S3 module
  $url = file_create_url($uri);
  if ($url != $uri && ($copy = self::createTemporaryLocalCopy($url))) {
    self::$temporaryCopies[$uri] = $copy;
    return $copy;
  }
  $copy = self::createTempFile(self::getExtension($uri));
  if (copy($uri, $copy)) {
    self::$temporaryCopies[$uri] = $copy;
    return $copy;
  }
  return FALSE;
}