コード例 #1
0
ファイル: upload.php プロジェクト: juho-jaakkola/elgg-videos
    move_uploaded_file($_FILES['upload']['tmp_name'], $video->getFilenameOnFilestore());
    // Change the directory mode
    chmod($video->getFileDirectory(), 0775);
    $guid = $video->save();
}
// video saved so clear sticky form
elgg_clear_sticky_form('video');
// handle results differently for new videos and video updates
if ($new_video) {
    if ($guid) {
        elgg_load_library('elgg:video');
        // Find out file info and save it as metadata
        $info = new VideoInfo($video);
        $video->resolution = $info->getResolution();
        $video->bitrate = $info->getBitrate();
        $video->duration = $info->getDuration();
        // Mark the video as unconverted so conversion script can find it
        $video->conversion_done = false;
        $video->save();
        $video->setSources();
        video_create_thumbnails($video);
        $message = elgg_echo("video:saved");
        system_message($message);
    } else {
        // failed to save video object - nothing we can do about this
        $error = elgg_echo("video:uploadfailed");
        register_error($error);
    }
    $container = get_entity($container_guid);
    if (elgg_instanceof($container, 'group')) {
        forward("video/group/{$container->guid}/all");