示例#1
0
 public function show()
 {
     $dir = TARGET_DIR . 'livesnap/';
     $time = $this->input['time'] ? $this->input['time'] : TIMENOW;
     $material = new material();
     $handle = dir($dir);
     $snaps = array();
     while ($file = $handle->read()) {
         if ($file == '.' || $file == '..' || !intval($file)) {
             continue;
         }
         if (!is_dir($dir . $file . '/')) {
             continue;
         }
         $sdir = $dir . $file . '/';
         $handle1 = dir($sdir);
         $i = 0;
         while ($file1 = $handle1->read()) {
             if (!is_file($sdir . $file1)) {
                 continue;
             }
             $vv = $sdir . $file1;
             $k = $file;
             @copy($vv, $dir . '/live_' . $k . '.png');
             $vv = $dir . '/live_' . $k . '.png';
             if (defined("TARGET_VIDEO_DOMAIN")) {
                 $pic = 'http://' . ltrim(TARGET_VIDEO_DOMAIN, 'http://') . '/' . 'livesnap/live_' . $k . '.png';
             } else {
                 $pic = $this->settings['videouploads']['protocol'] . $this->settings['videouploads']['host'] . '/' . 'livesnap/live_' . $k . '.png';
             }
             $kk = filemtime($vv);
             if (time() - $kk < 2) {
                 $img_info = $material->addMaterialNodb($pic, 1, 'livesnap/img/' . date('Y', $kk) . '/' . date('m', $kk));
                 $this->addItem($img_info[0]);
             } else {
                 @unlink($vv);
             }
             $i++;
         }
     }
     $this->output();
 }