* * You should have received a copy of the GNU General Public License * along with izap-videos for Elgg. If not, see <http://www.gnu.org/licenses/>. */ require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; // Get file GUID $file_guid = (int) get_input('file_guid', 0); // Get file thumbnail size //$size = get_input('size', 'small'); $file = get_entity($file_guid); if (!elgg_instanceof($file, 'object', 'izap_video')) { exit; } $filename = end(explode('/', $file->imagesrc)); $filename = '' . $filename; $izap_video_obj = new IzapVideo(); $thumbfile = $izap_video_obj->getTmpPath($filename); // Grab the file if ($thumbfile && !empty($thumbfile)) { $readfile = new ElggFile(); $readfile->owner_guid = $file->owner_guid; $readfile->setFilename($thumbfile); if (file_exists($readfile->getFilenameOnFilestore())) { $contents = $readfile->grabFile(); } $content_type = 'image/jpeg'; header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+10 days")), true); header("Pragma: public", true); header("Cache-Control: public", true); header("Content-Length: " . strlen($contents)); header("Content-type: {$content_type}", true);
/** * Save offserver video after getting responese from YouTube * * @version 5.0 */ function izap_youtube_response() { $id = get_input('id'); $url = 'https://www.youtube.com/watch?v=' . $id; $video_data = array('url' => $url); $izap_video = new IzapVideo(); if ($izap_video->guid == 0) { $new = true; } $izap_video->videourl = $url; $izap_video->saveYouTubeVideoData($video_data); if ($izap_video->save()) { if ($new == true) { if (is_callable('elgg_create_river_item')) { elgg_create_river_item(array('view' => 'river/object/izap_video/create', 'action_type' => 'create', 'subject_guid' => elgg_get_logged_in_user_guid(), 'object_guid' => $izap_video->getGUID())); } else { add_to_river('river/object/izap_video/create', 'create', elgg_get_logged_in_user_guid(), $izap_video->getGUID()); } } elgg_clear_sticky_form('izap_videos'); system_messages(elgg_echo('izap-videos:Save:success')); forward($izap_video->getURL($izap_video->getOwnerEntity(), GLOBAL_IZAP_VIDEOS_PAGEHANDLER)); } }
* GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with izap-videos for Elgg. If not, see <http://www.gnu.org/licenses/>. */ require_once dirname(dirname(dirname(__FILE__))) . "/engine/start.php"; $guid = (int) get_input('file_guid', 0); $entity = get_entity($guid); $izapqueue_obj = new izapQueue(); $get_converted_video = $izapqueue_obj->get_converted_video($guid); if (!elgg_instanceof($entity, 'object', 'izap_video')) { exit; } if ($get_converted_video) { $get_video_name = end(explode('/', $get_converted_video[0]['main_file'])); $izapvideo_obj = new IzapVideo(); $set_video_name = $izapvideo_obj->getTmpPath($get_video_name); $set_video_name = preg_replace('/\\.[^.\\s]{3,4}$/', '', $set_video_name) . '_c.flv'; $elggfile_obj = new ElggFile(); $elggfile_obj->owner_guid = $entity->owner_guid; $elggfile_obj->setFilename($set_video_name); if (file_exists($elggfile_obj->getFilenameOnFilestore())) { // echo $elggfile_obj->getFilenameOnFilestore(); exit; $contents = $elggfile_obj->grabFile(); } $content_type = 'video/x-flv'; header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', strtotime("+10 days")), true); header("Pragma: public", true); header("Cache-Control: public", true); header("Content-Length: " . strlen($contents)); header("Content-type: {$content_type}", true);