Example #1
0
 /**
  * Create Exif class
  *
  * @param string $file 
  * @author Thibaud Rohmer
  */
 public function __construct($file = null)
 {
     /// No file given
     if (!isset($file)) {
         return;
     }
     /// File isn't an image
     if (is_array($file) || !File::Type($file) || File::Type($file) != "Image") {
         return;
     }
     /// No right to view
     if (!Judge::view($file)) {
         return;
     }
     /// No exif extension installed
     if (!in_array("exif", get_loaded_extensions())) {
         $infos[''] = "Exif extension is not installed on the server";
         return;
     }
     /// Create wanted table
     $this->init_wanted();
     /// Read exif
     $raw_exif = @exif_read_data($file);
     /// Parse exif
     foreach ($this->wanted as $name => $data) {
         foreach ($data as $d) {
             if (isset($raw_exif[$d])) {
                 $this->exif[$name] = $this->parse_exif($d, $raw_exif);
             }
         }
     }
     $this->filename = basename($file);
 }
Example #2
0
 /**
  * Create image
  *
  * @param string $file 
  * @author Thibaud Rohmer
  */
 public function __construct($file = NULL, $forcebig = false)
 {
     /// Check file type
     if (!isset($file) || !File::Type($file) || File::Type($file) != "Image") {
         return;
     }
     /// Set relative path (url encoded)
     $this->fileweb = urlencode(File::a2r($file));
     /// Set relative path to parent dir (url encoded)
     $this->dir = urlencode(dirname(File::a2r($file)));
     /// Get image dimensions
     list($this->x, $this->y) = getimagesize($file);
     /// Set big image
     if ($forcebig) {
         $this->t = "Big";
     } else {
         $this->t = "Img";
         if ($this->x >= 1200 || $this->y >= 1200) {
             if ($this->x > $this->y) {
                 $this->x = 1200;
             } else {
                 $this->x = $this->x * 1200 / $this->y;
             }
         }
     }
 }
Example #3
0
 /**
  * Create ImagePanel
  *
  * @param string $file 
  * @author Thibaud Rohmer
  */
 public function __construct($file = NULL)
 {
     if (!isset($file)) {
         return;
     }
     $file_type = File::Type($file);
     if ($file_type == "Image") {
         /// Create Image object
         $this->image = new Image($file);
     } elseif ($file_type == "Video") {
         /// Create Video object
         $this->video = new Video($file);
     }
     /// Create Image object
     $this->imagebar = new ImageBar($file);
     /// Create EXIF object
     $this->exif = new Exif($file);
     if (!Settings::$nocomments) {
         /// Create Comments object
         $this->comments = new Comments($file);
     }
     $pageURL = Settings::$site_address . "/?f=" . urlencode(File::a2r($file));
     // generate the header - opengraph metatags for facebook
     $this->page_header = "<meta property=\"og:url\" content=\"" . $pageURL . "\"/>\n" . "<meta property=\"og:site_name\" content=\"" . Settings::$name . "\"/>\n" . "<meta property=\"og:type\" content=\"website\"/>\n" . "<meta property=\"og:title\" content=\"" . Settings::$name . ": " . File::a2r($file) . "\"/>\n" . "<meta property=\"og:image\" content=\"" . Settings::$site_address . "/?t=Thb&f=" . urlencode(File::a2r($file)) . "\"/>\n";
     if (Settings::$fbappid) {
         $this->page_header .= "<meta property=\"fb:app_id\" content=\"" . Settings::$fbappid . "\"/>\n";
     }
     /// Set the Judge
     $this->judge = new Judge($file);
 }
Example #4
0
 /**
  * Append an item to the board
  *
  * @param string $file 
  * @param string $ratio 
  * @return void
  * @author Thibaud Rohmer
  */
 public function add_item($file, $ratio)
 {
     /// Check item
     if (!File::Type($file)) {
         return;
     }
     /// Append item
     $this->items[] = new BoardItem($file, $ratio);
     /// Update total ratio
     $this->ratio = $ratio + $this->ratio;
 }
Example #5
0
 public function PreProcess()
 {
     $v = Validator::Create();
     $v->Register($this->source[Video_Source::FIELD_EMBED], Validator_Type::NOT_EMPTY, 'The Embed Code field is required');
     $v->Register($this->source[Video_Source::FIELD_DURATION], Validator_Type::VALID_TIME, 'The Video Duration field must be in HH:MM:SS format');
     $this->duration = Format::DurationToSeconds($this->source[Video_Source::FIELD_DURATION]);
     $this->video_dir = new Video_Dir(null, 0700);
     Request::FixFiles();
     // No thumbnails uploaded
     if (!isset($_FILES[Video_Source::FIELD_THUMBNAILS])) {
         return;
     }
     // Process each uploaded file
     foreach ($_FILES[Video_Source::FIELD_THUMBNAILS] as $upload) {
         // No file uploaded in this field
         if ($upload['error'] == UPLOAD_ERR_NO_FILE) {
             continue;
         }
         // Check for other errors
         if ($upload['error'] != UPLOAD_ERR_OK) {
             throw new BaseException(Uploads::CodeToMessage($upload['error']));
         }
         switch (File::Type($upload['name'])) {
             case File::TYPE_ZIP:
                 foreach (Zip::ExtractEntries($upload['tmp_name'], File::TYPE_JPEG) as $name => $data) {
                     $thumbs[] = $this->video_dir->AddTempFromVar($data, JPG_EXTENSION);
                 }
                 break;
             case File::TYPE_JPEG:
                 $thumbs[] = $this->video_dir->AddTempFromFile($upload['tmp_name'], JPG_EXTENSION);
                 break;
         }
     }
     // Resize (if possible) and move images to the correct directory
     if (Video_Thumbnail::CanResize()) {
         $this->thumbs = Video_Thumbnail::ResizeDirectory($this->video_dir->GetTempDir(), $this->video_dir->GetThumbsDir(), Config::Get('thumb_size'), Config::Get('thumb_quality'));
     } else {
         $this->thumbs = $this->video_dir->MoveFiles(Video_Dir::TEMP, Video_Dir::THUMBS, JPG_EXTENSION);
     }
     // Cleanup temp and processing dirs
     $this->video_dir->ClearTemp();
     $this->video_dir->ClearProcessing();
 }
Example #6
0
 public static function ExtractEntries($archive, $type)
 {
     $si = ServerInfo::GetCached();
     if (!$si->php_extensions[ServerInfo::EXT_ZIP]) {
         throw new BaseException('Sorry, the ZIP extension for PHP is not available on this server');
     }
     $entries = array();
     $zip = zip_open($archive);
     if (!is_resource($zip)) {
         throw new BaseException('Invalid zip file; zip error #' . $zip . ' generated');
     }
     while (($entry = zip_read($zip)) !== false) {
         if (!is_resource($entry)) {
             throw new BaseException('Invalid zip entry; zip error #' . $zip . ' generated');
         }
         $name = zip_entry_name($entry);
         if (File::Type($name) == $type) {
             $entries[basename($name)] = self::ExtractEntry($zip, $entry);
         }
     }
     zip_close($zip);
     return $entries;
 }
Example #7
0
 /**
  * Display ImagePanel on website
  *
  * @return void
  * @author Thibaud Rohmer
  */
 public function toHTML()
 {
     if (!isset($this->image)) {
         return;
     }
     /*
     		echo "<div id='exif' class='box'>\n";
     		$this->exif->toHTML();
     */
     /*
     		if(CurrentUser::$admin){
     			$this->judge->toHTML();
     		}
     
     		echo "</div>\n";
     */
     if (!File::Type($this->file) || File::Type($this->file) == "Image") {
         echo "<div id='bigimage'>\n";
         $this->image->toHTML();
         echo "</div>\n";
     }
     if (!File::Type($this->file) || File::Type($this->file) == "Video") {
         echo "<div id='bigvideo'>\n";
         $this->video->toHTML();
         echo "</div>\n";
     }
     echo "<div id='image_bar'>\n";
     $this->imagebar->toHTML();
     echo "</div>\n";
     /*
     		echo "<div id='comments' class='box'>\n";
     		if(!Settings::$nocomments){
     			$this->comments->toHTML();
     		}
     		echo "</div>\n";
     */
 }
Example #8
0
 /**
  * Asynchronous Convert all Video format to video/webm
  *   
  * Use ffmpeg for conversion
  * @return void
  * @author Cédric Levasseur
  */
 public static function FastEncodeVideo($file)
 {
     /// Check item
     if (!File::Type($file) || File::Type($file) != "Video") {
         return;
     }
     $file_file = new File($file);
     $thumb_path_no_ext = Settings::$thumbs_dir . dirname(File::a2r($file)) . "/" . $file_file->name;
     $thumb_path_webm = $thumb_path_no_ext . '.webm';
     $thumb_path_jpg = $thumb_path_no_ext . '.jpg';
     // Check if thumb folder exist
     if (!file_exists(dirname($thumb_path_webm))) {
         @mkdir(dirname($thumb_path_webm), 0755, true);
     }
     if (!file_exists($thumb_path_jpg) || filectime($file) > filectime($thumb_path_jpg)) {
         //Create Thumbnail jpg in Thumbs folder
         //TODO: scaled thumbnail would be better
         $offset = self::GetDuration($file) / 2;
         $dimensions = self::GetScaledDimension($file, 320);
         $u = Settings::$ffmpeg_path . ' -itsoffset -' . $offset . '  -i "' . $file . '" -vcodec mjpeg -vframes 1 -an -f rawvideo -s ' . $dimensions['x'] . 'x' . $dimensions['y'] . ' -y "' . $thumb_path_jpg . '"';
         self::ExecInBackground($u);
     }
     if (self::NoJob($file)) {
         if (!file_exists($thumb_path_webm) || filectime($file) > filectime($thumb_path_webm)) {
             if ($file_file->extension != "webm") {
                 ///Convert video to webm format in Thumbs folder
                 //TODO: Max job limit
                 $u = Settings::$ffmpeg_path . ' -i "' . $file . '" ' . Settings::$ffmpeg_option . ' -y "' . $thumb_path_webm . '"';
                 $pid = self::ExecInBackground($u);
                 self::CreateJob($file, $pid);
             } else {
                 ///Copy original webm video to Thumbs folder
                 copy($file, $thumb_path_webm);
             }
         }
     }
 }
Example #9
0
 /**
  * List files in $dir, omit hidden files
  *
  * @param string $dir 
  * @return void
  * @author Thibaud Rohmer
  */
 public static function list_files($dir, $rec = false, $hidden = false, $stopatfirst = false)
 {
     /// Directories list
     $list = array();
     /// Check that $dir is a directory, or throw exception
     if (!is_dir($dir)) {
         throw new Exception("'" . $dir . "' is not a directory");
     }
     /// Directory content
     $dir_content = scandir($dir);
     if (empty($dir_content)) {
         // Directory is empty or no right to read
         return $list;
     }
     /// Check each content
     foreach ($dir_content as $content) {
         /// Content isn't hidden and is a file
         if ($content[0] != '.' || $hidden) {
             if (is_file($path = $dir . "/" . $content)) {
                 if (File::Type($path) && (File::Type($path) == "Image" || File::Type($path) == "Video")) {
                     /// Add content to list
                     $list[] = $path;
                     /// We found the first one
                     if ($stopatfirst) {
                         return $list;
                     }
                 }
             } else {
                 if ($rec) {
                     $list = array_merge($list, Menu::list_files($dir . "/" . $content, true));
                 }
             }
         }
     }
     /// Return files list
     return $list;
 }
Example #10
0
 /**
  * Provide an image to the user, if he is allowed to
  * see it. If $thumb is true, provide the thumb associated
  * to the image.
  *
  * @param string $file 
  * @param string $thumb 
  * @return void
  * @author Thibaud Rohmer
  */
 public static function Image($file, $thumb = false, $large = false, $output = true, $dl = false)
 {
     if (!Judge::view($file)) {
         return;
     }
     if (function_exists("error_reporting")) {
         error_reporting(0);
     }
     /// Check item
     $file_type = File::Type($file);
     switch ($file_type) {
         case "Image":
             $is_video = false;
             break;
         case "Video":
             $is_video = true;
             break;
         default:
             return;
     }
     //error_log('DEBUG/Provider::image: '.$file.' '.($is_video?'is_video':''));
     if (!$large) {
         try {
             if ($is_video) {
                 //TODO: fix so when opening the folder the first time no need to do F5 to see
                 //the freshly created thumbnail
                 Video::FastEncodeVideo($file);
                 $basefile = new File($file);
                 $basepath = File::a2r($file);
                 $path = Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . ".jpg";
             } elseif ($thumb) {
                 // Img called on a video, return the thumbnail
                 $path = Provider::thumb($file);
             } else {
                 $path = Provider::small($file);
             }
         } catch (Exception $e) {
             // do nothing
         }
     }
     if (!isset($path) || !file_exists($path)) {
         error_log('ERROR/Provider::image path:' . $path . ' does not exist, using ' . $file);
         $path = $file;
     }
     if ($output) {
         if ($dl) {
             header('Content-Disposition: attachment; filename="' . basename($file) . '"');
         } else {
             $expires = 60 * 60 * 24 * 14;
             $last_modified_time = filemtime($path);
             $last_modified_time = 0;
             $etag = md5_file($file);
             header("Last-Modified: " . 0 . " GMT");
             header("Pragma: public");
             header("Cache-Control: max-age=360000");
             header("Etag: {$etag}");
             header("Cache-Control: maxage=" . $expires);
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
         }
         header('Content-type: image/jpeg');
         if (File::Type($path) == "Image") {
             readfile($path);
             return;
             try {
                 imagejpeg(Provider::autorotate_jpeg($path));
             } catch (Exception $e) {
                 error_log('ERROR/Provider.php: cannot rotate ' . $path . ': ' . $e);
                 readfile($path);
             }
         } else {
             readfile($path);
         }
     }
 }
Example #11
0
 /**
  * Provide an image to the user, if he is allowed to
  * see it. If $thumb is true, provide the thumb associated
  * to the image.
  *
  * @param string $file 
  * @param string $thumb 
  * @return void
  * @author Thibaud Rohmer
  */
 public static function image($file, $thumb = false, $large = false, $output = true, $dl = false)
 {
     if (!Judge::view($file)) {
         return;
     }
     if (function_exists("error_reporting")) {
         error_reporting(0);
     }
     /// Check item
     //~ if(!File::Type($file) || File::Type($file) != "Image"){
     //~ return;
     //~ }
     if (File::Type($file) == "Video") {
         $basefile = new File($file);
         $basepath = File::a2r($file);
         /// Build relative path to webimg
         $path = Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . ".jpg";
         Video::FastEncodeVideo($file, $basefile->extension);
         $large = true;
     }
     if (!$large) {
         try {
             if ($thumb) {
                 $path = File::r2a(File::a2r($file), Settings::$thumbs_dir);
                 if (!file_exists($path) || filectime($file) > filectime($path)) {
                     require_once dirname(__FILE__) . '/../phpthumb/ThumbLib.inc.php';
                     /// Create directories
                     if (!file_exists(dirname($path))) {
                         @mkdir(dirname($path), 0750, true);
                     }
                     /// Create thumbnail
                     $thumb = PhpThumbFactory::create($file);
                     $thumb->resize(200, 200);
                     $thumb->save($path);
                 }
             } else {
                 list($x, $y) = getimagesize($file);
                 if ($x > 800 || $y > 600) {
                     require_once dirname(__FILE__) . '/../phpthumb/ThumbLib.inc.php';
                     $basefile = new File($file);
                     $basepath = File::a2r($file);
                     /// Build relative path to webimg
                     $webimg = dirname($basepath) . "/" . $basefile->name . "_small." . $basefile->extension;
                     /// Set absolute path to comments file
                     $path = File::r2a($webimg, Settings::$thumbs_dir);
                     if (!file_exists($path) || filectime($file) > filectime($path)) {
                         /// Create smaller image
                         if (!file_exists(dirname($path))) {
                             @mkdir(dirname($path), 0755, true);
                         }
                         $thumb = PhpThumbFactory::create($file);
                         $thumb->resize(800, 600);
                         $thumb->save($path);
                     }
                 } else {
                     $path = $file;
                 }
             }
         } catch (Exception $e) {
             // do nothing
         }
     }
     if (!isset($path) || !file_exists($path)) {
         $path = $file;
     }
     if ($output) {
         if ($dl) {
             header('Content-Disposition: attachment; filename="' . basename($file) . '"');
             header('Content-type: image/jpeg');
         } else {
             $expires = 60 * 60 * 24 * 14;
             $last_modified_time = filemtime($path);
             $last_modified_time = 0;
             $etag = md5_file($file);
             header("Last-Modified: " . 0 . " GMT");
             header("Pragma: public");
             header("Cache-Control: max-age=360000");
             header("Etag: {$etag}");
             header("Cache-Control: maxage=" . $expires);
             header('Expires: ' . gmdate('D, d M Y H:i:s', time() + $expires) . ' GMT');
             header('Content-type: image/jpeg');
         }
         readfile($path);
     }
 }
Example #12
0
 /**
  * Calculate item ratio.
  * - Image -> floor(width/height) + 1
  * - Autre -> 2
  *
  * @param string $file 
  * @return void
  * @author Thibaud Rohmer
  */
 private function ratio($file)
 {
     // Non-image file : ratio = 2
     if (!File::Type($file) || File::Type($file) != "Image") {
         return 2;
     }
     // Calculate ratio
     list($x, $y) = getimagesize($file);
     return floor($x / $y) + 1;
 }
Example #13
0
 public static function Video($file, $width = '100%', $height = '100%', $control = false)
 {
     if (!Judge::view($file)) {
         return;
     }
     if (function_exists("error_reporting")) {
         error_reporting(0);
     }
     /// Check item
     if (!File::Type($file) || File::Type($file) != "Video") {
         return;
     }
     $basefile = new File($file);
     $basepath = File::a2r($file);
     $path_webm = Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . '.webm';
     $c = null;
     Video::FastEncodeVideo($file);
     $wh = ' height="' . $height . '" width="' . $width . '"';
     if ($control) {
         $c = ' controls="controls"';
     }
     echo '<video' . $wh . $c . '><source src="' . $path_webm . '" type="video/webm" /></video>';
     //echo 'Webm Video Codec not found.Plaese up to date the brower or Download the codec <a href="http://tools.google.com/dlpage/webmmf">Download</a>';
 }
Example #14
0
 /**
  * Generate the grid, line by line
  *
  * @return void
  * @author Thibaud Rohmer
  */
 private function grid($type = "Image")
 {
     $this->boarditems = array();
     foreach ($this->files as $file) {
         // Check rights
         if (!Judge::view($file)) {
             continue;
         }
         // Check filetype
         if (File::Type($file) != $type) {
             continue;
         }
         $this->boarditems[] = new BoardItem($file);
     }
 }
Example #15
0
 public function PreProcess()
 {
     $this->video_dir = new Video_Dir(null, 0700);
     Request::FixFiles();
     if (!isset($_FILES[Video_Source::FIELD_UPLOADS])) {
         throw new BaseException('No files were uploaded');
     }
     foreach ($_FILES[Video_Source::FIELD_UPLOADS] as $upload) {
         // No file uploaded in this field
         if ($upload['error'] == UPLOAD_ERR_NO_FILE) {
             continue;
         }
         // Check for other errors
         if ($upload['error'] != UPLOAD_ERR_OK) {
             throw new BaseException(Uploads::CodeToMessage($upload['error']));
         }
         $thumbs = array();
         $will_grab = Video_Info::CanExtract() && Video_FrameGrabber::CanGrab();
         switch (File::Type($upload['name'])) {
             case File::TYPE_ZIP:
                 foreach (Zip::ExtractEntries($upload['tmp_name'], File::TYPE_JPEG) as $name => $data) {
                     $thumbs[] = $this->video_dir->AddTempFromVar($data, JPG_EXTENSION);
                 }
                 foreach (Zip::ExtractEntries($upload['tmp_name'], File::TYPE_VIDEO) as $name => $data) {
                     $this->clips[] = $this->video_dir->AddClipFromVar($data, File::Extension($name));
                 }
                 break;
             case File::TYPE_JPEG:
                 $thumbs[] = $this->video_dir->AddTempFromFile($upload['tmp_name'], JPG_EXTENSION);
                 break;
             case File::TYPE_VIDEO:
                 $this->clips[] = $this->video_dir->AddClipFromFile($upload['tmp_name'], File::Extension($upload['name']));
                 break;
         }
     }
     // Make sure at least one video clip was uploaded
     if (empty($this->clips)) {
         throw new BaseException('No video files were uploaded');
     }
     // Try to grab frames from video files
     if ($will_grab) {
         $amount = round(Config::Get('thumb_amount') / count($this->clips));
         foreach ($this->clips as $clip) {
             $vi = new Video_Info($clip);
             $vi->Extract();
             $this->duration += $vi->length;
             $temp_thumbs = Video_FrameGrabber::Grab($clip, $this->video_dir->GetProcessingDir(), $amount, Config::Get('thumb_quality'), Config::Get('thumb_size'));
             // Move generated thumbs from the processing directory
             foreach ($temp_thumbs as $temp_thumb) {
                 $this->thumbs[] = $this->video_dir->AddThumbFromFile($temp_thumb);
             }
             $this->video_dir->ClearProcessing();
         }
     } else {
         $this->duration = $this->source[Video_Source::FIELD_DURATION];
     }
     // Use uploaded images if none could be generated
     if (empty($this->thumbs) && !empty($thumbs)) {
         if (Video_Thumbnail::CanResize()) {
             $this->thumbs = Video_Thumbnail::ResizeDirectory($this->video_dir->GetTempDir(), $this->video_dir->GetThumbsDir(), Config::Get('thumb_size'), Config::Get('thumb_quality'));
         } else {
             $this->thumbs = $this->video_dir->MoveFiles(Video_Dir::TEMP, Video_Dir::THUMBS, JPG_EXTENSION);
         }
     }
     // Cleanup temp and processing dirs
     $this->video_dir->ClearTemp();
     $this->video_dir->ClearProcessing();
 }
Example #16
0
 public function PreProcess()
 {
     $this->video_dir = new Video_Dir(null, 0700);
     $thumbs = array();
     $clips = array();
     foreach ($this->source[Video_Source::FIELD_URLS] as $url) {
         $url_path = parse_url($url, PHP_URL_PATH);
         switch (File::Type($url_path)) {
             case File::TYPE_ZIP:
                 $http = new HTTP();
                 if ($http->Get($url, $url)) {
                     $zip = $this->video_dir->AddTempFromVar($http->body, ZIP_EXTENSION);
                     foreach (Zip::ExtractEntries($zip, File::TYPE_JPEG) as $name => $data) {
                         $thumbs[] = $this->video_dir->AddTempFromVar($data, JPG_EXTENSION);
                     }
                     foreach (Zip::ExtractEntries($zip, File::TYPE_VIDEO) as $name => $data) {
                         $this->clips[] = $this->video_dir->AddClipFromVar($data, File::Extension($name));
                     }
                 }
                 break;
             case File::TYPE_JPEG:
                 $http = new HTTP();
                 if ($http->Get($url, $url)) {
                     $thumbs[] = $this->video_dir->AddTempFromVar($http->body, JPG_EXTENSION);
                 }
                 break;
             case File::TYPE_VIDEO:
                 if ($this->source[Video_Source::FLAG_HOTLINK]) {
                     $clips[] = $url;
                     $this->duration = Format::DurationToSeconds($this->source[Video_Source::FIELD_DURATION]);
                 } else {
                     $http = new HTTP();
                     if ($http->Get($url, $url)) {
                         $this->clips[] = $this->video_dir->AddClipFromVar($http->body, File::Extension($http->url));
                     }
                 }
                 break;
         }
     }
     if (empty($clips)) {
         if (!empty($this->clips) && Video_Info::CanExtract() && Video_FrameGrabber::CanGrab()) {
             $amount = round(Config::Get('thumb_amount') / count($this->clips));
             foreach ($this->clips as $clip) {
                 $vi = new Video_Info($clip);
                 $vi->Extract();
                 $this->duration += $vi->length;
                 $temp_thumbs = Video_FrameGrabber::Grab($clip, $this->video_dir->GetProcessingDir(), $amount, Config::Get('thumb_quality'), Config::Get('thumb_size'));
                 // Move generated thumbs from the processing directory
                 foreach ($temp_thumbs as $temp_thumb) {
                     $this->thumbs[] = $this->video_dir->AddThumbFromFile($temp_thumb);
                 }
                 $this->video_dir->ClearProcessing();
             }
         }
     } else {
         $this->clips = $clips;
     }
     if (empty($this->clips)) {
         throw new BaseException('No valid video URLs were submitted');
     }
     // Use images from supplied URLs if none could be generated
     if (empty($this->thumbs) && !empty($thumbs)) {
         if (Video_Thumbnail::CanResize()) {
             $this->thumbs = Video_Thumbnail::ResizeDirectory($this->video_dir->GetTempDir(), $this->video_dir->GetThumbsDir(), Config::Get('thumb_size'), Config::Get('thumb_quality'));
         } else {
             $this->thumbs = $this->video_dir->MoveFiles($this->video_dir->GetTempDir(), $this->video_dir->GetThumbsDir(), JPG_EXTENSION);
         }
     }
     // Cleanup temp and processing dirs
     $this->video_dir->ClearTemp();
     $this->video_dir->ClearProcessing();
 }