当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObjMediaObject::generatePreviewPic方法代码示例

本文整理汇总了PHP中ilObjMediaObject::generatePreviewPic方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::generatePreviewPic方法的具体用法?PHP ilObjMediaObject::generatePreviewPic怎么用?PHP ilObjMediaObject::generatePreviewPic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObjMediaObject的用法示例。


在下文中一共展示了ilObjMediaObject::generatePreviewPic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveCastItemObject

 /**
  * Save new cast item
  */
 function saveCastItemObject()
 {
     global $tpl, $ilCtrl, $ilUser, $lng, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("edit_content");
     $this->initAddCastItemForm();
     if ($_POST["url_Standard"] == "" && !$_FILES['file_Standard']['tmp_name']) {
         ilUtil::sendFailure($lng->txt("msg_input_either_file_or_url"));
         $this->populateFormFromPost();
     } else {
         if ($this->form_gui->checkInput()) {
             // create dummy object in db (we need an id)
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
             $mob = new ilObjMediaObject();
             $mob->create();
             //handle standard purpose
             $file = $this->createMediaItemForPurpose($mob, "Standard");
             // set title and description
             // set title to basename of file if left empty
             $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
             $description = $this->form_gui->getInput("description");
             $mob->setTitle($title);
             $mob->setDescription($description);
             // save preview pic
             $prevpic = $this->form_gui->getInput("preview_pic");
             if ($prevpic["size"] > 0) {
                 $mob->uploadVideoPreviewPic($prevpic);
             }
             // determine duration for standard purpose
             $duration = $this->getDuration($file);
             // handle other purposes
             foreach ($this->additionalPurposes as $purpose) {
                 // check if some purpose has been uploaded
                 $file_gui = $this->form_gui->getInput("file_" . $purpose);
                 $url_gui = $this->form_gui->getInput("url_" . $purpose);
                 if ($url_gui || $file_gui["size"] > 0) {
                     $this->createMediaItemForPurpose($mob, $purpose);
                 }
             }
             $mob->update();
             if ($prevpic["size"] == 0) {
                 // re-read media object
                 $mob = new ilObjMediaObject($mob->getId());
                 $mob->generatePreviewPic(320, 240);
             }
             //
             // @todo: save usage
             //
             $news_set = new ilSetting("news");
             $enable_internal_rss = $news_set->get("enable_rss_for_internal");
             // create new media cast item
             include_once "./Services/News/classes/class.ilNewsItem.php";
             $mc_item = new ilNewsItem();
             $mc_item->setMobId($mob->getId());
             $mc_item->setContentType(NEWS_AUDIO);
             $mc_item->setContextObjId($this->object->getId());
             $mc_item->setContextObjType($this->object->getType());
             $mc_item->setUserId($ilUser->getId());
             $mc_item->setPlaytime($duration);
             $mc_item->setTitle($title);
             $mc_item->setContent($description);
             $mc_item->setLimitation(false);
             if ($enable_internal_rss) {
                 $mc_item->setVisibility($this->form_gui->getInput("visibility"));
             } else {
                 $mc_item->setVisibility("users");
             }
             $mc_item->create();
             $ilCtrl->redirect($this, "listItems");
         } else {
             $this->populateFormFromPost();
         }
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:77,代码来源:class.ilObjMediaCastGUI.php


注:本文中的ilObjMediaObject::generatePreviewPic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。