コード例 #1
0
 /**
  * Create new video entity
  * 
  * @return ElggEntity VIDEOS
  * 
  * @version 5.0
  */
 public function createVideoEntity()
 {
     if (!filter_var($this->input, FILTER_VALIDATE_URL)) {
         $this->errors[] = 'Not valid url, currently supported for OFFSERVER videos only';
         return FALSE;
     }
     // try saving the entity now
     $izap_videos = new IzapVideos();
     $izap_videos->access_id = ACCESS_PUBLIC;
     $return = $izap_videos->input($this->input, 'url');
     if (isset($return->status) && $return->status === FALSE) {
         $this->errors[] = $return->message;
         return FALSE;
     }
     if ($return->videosrc == '' || $return->filecontent == '') {
         $this->errors[] = elgg_echo('izap_videos:error');
         return FALSE;
     }
     $izap_videos->title = $return->title;
     $izap_videos->description = $return->description;
     $izap_videos->tags = string_to_tag_array($return->videotags);
     $izap_videos->videosrc = $return->videosrc;
     $izap_videos->videotype = $return->type;
     $izap_videos->orignal_thumb = "izap_videos/" . $return->type . "/orignal_" . $return->filename;
     $izap_videos->imagesrc = "izap_videos/" . $return->type . "/" . $return->filename;
     $izap_videos->videotype_site = $return->domain;
     $izap_videos->converted = 'yes';
     $izap_videos->setFilename($izap_videos->orignal_thumb);
     $izap_videos->open("write");
     if ($izap_videos->write($return->filecontent)) {
         $thumb = get_resized_image_from_existing_file($izap_videos->getFilenameOnFilestore(), 120, 90, true);
         $izap_videos->setFilename($izap_videos->imagesrc);
         $izap_videos->open("write");
         if (!$izap_videos->write($thumb)) {
             $this->errors[] = elgg_echo('izap_videos:error:saving_thumb');
             return FALSE;
         }
     } else {
         $this->errors[] = elgg_echo('izap_videos:error:saving_thumb');
         return FALSE;
     }
     // if every thing is good till here now we can save it.
     if (!$izap_videos->save()) {
         $this->errors[] = register_error(elgg_echo('izap_videos:error:save'));
         return FALSE;
     }
     return $izap_videos;
 }
コード例 #2
0
$pdo_sqlite = extension_loaded('pdo_sqlite') ? true : false;
if ($exec) {
    $php_command = exec(izapAdminSettings_izap_videos('izapPhpInterpreter') . ' --version', $output_PHP, $return_value);
    if ($return_value === 0) {
        $php = nl2br(implode('', $output_PHP));
    }
    $ffmpeg_command = exec($ffmpeg_path . ' -version', $output_FFmpeg, $return_var);
    if ($return_var === 0) {
        $ffmpeg = nl2br(implode($output_FFmpeg));
        $in_video = elgg_get_plugins_path() . 'izap_videos/server_test/test_video.avi';
        $izap_videos = new IzapVideos();
        $izap_videos->owner_guid = elgg_get_logged_in_user_guid();
        $izap_videos->setFilename('izap_videos/server_test/test_video.avi');
        $izap_videos->open('write');
        $izap_videos->write(file_get_contents($in_video));
        $in_video = $izap_videos->getFilenameOnFilestore();
        if (!file_exists($in_video)) {
            $in_video = elgg_get_plugins_path() . 'izap_videos/server_test/test_video.avi';
            exit;
            $izap_videos->open('write');
            $izap_videos->write(file_get_contents($in_video));
            $in_video = $izap_videos->getFilenameOnFilestore();
        }
        $izap_videos->close();
        if (file_exists($in_video)) {
            $in_video;
            $outputPath = substr($in_video, 0, -4);
            $out_video = $outputPath . '_c.flv';
            $commands = array('Simple command' => $ffmpeg_path . ' -y -i [inputVideoPath] [outputVideoPath]');
        }
    }
コード例 #3
0
ファイル: addEdit.php プロジェクト: rimpy/izap_videos
            register_error(elgg_echo('izap_videos:error:emptyEmbedCode'));
            forward($_SERVER['HTTP_REFERER']);
        }
        include_once dirname(__FILE__) . '/EMBED.php';
        break;
    default:
        //    register_error(elgg_echo('izap_videos:error:unknownFileType'));
        //    forward($_SERVER['HTTP_REFERER']);
        break;
}
// if we have the optional image then replace all the previous values
if ($_FILES['izap']['error']['videoImage'] == 0 && in_array(strtolower(end(explode('.', $_FILES['izap']['name']['videoImage']))), array('jpg', 'gif', 'jpeg', 'png'))) {
    $izap_videos->setFilename($izap_videos->orignal_thumb);
    $izap_videos->open("write");
    $izap_videos->write(file_get_contents($_FILES['izap']['tmp_name']['videoImage']));
    $thumb = get_resized_image_from_existing_file($izap_videos->getFilenameOnFilestore(), 120, 90, true);
    $izap_videos->setFilename($izap_videos->imagesrc);
    $izap_videos->open("write");
    $izap_videos->write($thumb);
}
// filter tags
if (is_array($izap_videos->tags)) {
    $filtered_tags = FALSE;
    foreach ($izap_videos->tags as $tag) {
        if ($tag != '') {
            $filtered_tags[] = $tag;
        }
    }
    if ($filtered_tags) {
        $izap_videos->tags = array_unique($filtered_tags);
    }