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


PHP kFile::fixPath方法代码示例

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


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

示例1: createWidgetImage

 public static function createWidgetImage($partner, $create)
 {
     $contentPath = myContentStorage::getFSContentRootPath();
     $path = kFile::fixPath($contentPath . $partner->getWidgetImagePath());
     // if the create flag is not set and the file doesnt exist exit
     // e.g. the roughcut name has change, we update the image only if it was already in some widget
     if (!$create && !file_exists($path)) {
         return;
     }
     $im = imagecreatetruecolor(400, 20);
     $green = imagecolorallocate($im, 188, 230, 99);
     $white = imagecolorallocate($im, 255, 255, 255);
     $font = SF_ROOT_DIR . '/web/ttf/arial.ttf';
     $fontSize = 9;
     $bottom = 15;
     $pos = imagettftext($im, $fontSize, 0, 10, $bottom, $green, $font, $partner->getPartnerName() . " Collaborative Video");
     $pos = imagettftext($im, $fontSize, 0, $pos[2], $bottom, $white, $font, " powered by ");
     imagettftext($im, $fontSize, 0, $pos[2], $bottom, $green, $font, "Kaltura");
     kFile::fullMkdir($path);
     imagegif($im, $path);
     imagedestroy($im);
 }
开发者ID:dozernz,项目名称:server,代码行数:22,代码来源:myPartnerUtils.class.php

示例2: addKuserPictureFromEntry

 private static function addKuserPictureFromEntry($contentPath, $im, &$entries, $x, $y, $border = 1, $width = self::DIM_X, $height = self::DIM_Y)
 {
     $entry = current($entries);
     if ($entry == NULL) {
         // for now - if there are not enough images - stop !
         return;
         // if we reach here - we want to rotate the images we already used
         reset($entries);
         $entry = current($entries);
     }
     $kuser = $entry->getKuser();
     $kuser_image_path = kFile::fixPath($contentPath . $kuser->getPicturePath());
     if (file_exists($kuser_image_path)) {
         list($sourcewidth, $sourceheight, $type, $attr, $kuserIm) = myFileConverter::createImageByFile($kuser_image_path);
         if ($kuserIm) {
             $kuserIm_x = imagesx($kuserIm);
             $kuserIm_y = imagesy($kuserIm);
             // focus on the ceter of the image - ignore 10% from each side to make the center bigger
             imagecopyresampled($im, $kuserIm, $width * $x, $height * $y, $kuserIm_x * 0.1, $kuserIm_y * 0.1, $width - $border, $height - $border, $kuserIm_x * 0.9, $kuserIm_y * 0.9);
             imagedestroy($kuserIm);
         }
     }
     next($entries);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:24,代码来源:myKshowUtils.class.php

示例3: getVideoDimensions

 public static function getVideoDimensions($source_file)
 {
     $source_file = kFile::fixPath($source_file);
     if (realpath($source_file) === FALSE) {
         throw new Exception("Illegal input was supplied");
     }
     ob_start();
     $cmd_line = kConf::get("bin_path_ffmpeg") . " -i \"" . $source_file . "\" 2>&1";
     passthru($cmd_line);
     echo $cmd_line;
     $size = ob_get_contents();
     ob_end_clean();
     $width = "";
     $height = "";
     //extract the video size line (used to suggest 25x25 sise for entry 25x25xqajo)
     // used to search for , after the {width}x{height} however both of the following lines are valid:
     // Stream #0.0: Video: h264, yuv420p, 320x240 [PAR 1:1 DAR 4:3], 202 kb/s, 29.92 tbr, 1k tbn, 2k tbc
     // Stream #0.1(und): Video: h264, yuv420p, 480x270, 59.92 tbr, 29.94 tbn, 59.89 tbc
     if (preg_match('/Video:.*? (\\d{2,4})x(\\d{2,4})/', $size, $matches)) {
         $width = $matches[1];
         $height = $matches[2];
     }
     $res = array($width, $height);
     return $res;
 }
开发者ID:DBezemer,项目名称:server,代码行数:25,代码来源:myFileConverter.class.php

示例4: fixMetadataImpl

 /**
  * here we'll manipulate the video asset and set the from_byte & to_byte from the milliseconds
  *
  */
 private static function fixMetadataImpl(&$xml_doc, &$total_duration, $timeline)
 {
     self::log(__METHOD__);
     /*
     	$xml_doc = new DOMDocument();
     	$xml_doc->loadXML( $content );
     */
     //		$meatadata_elem_list = $xml_doc->getElementsByTagName( "MetaData" );
     //		if ( $meatadata_elem_list != null && $meatadata_elem_list->length > 0 )
     $duration_list = $xml_doc->getElementsByTagName("SeqDuration");
     if ($duration_list != null && $duration_list->length > 0) {
         $total_duration = $duration_list->item(0)->nodeValue;
     }
     $xpath = new DOMXPath($xml_doc);
     $assets = $xpath->query($timeline == "video" ? "//VideoAssets/vidAsset" : ($timeline == "audio" ? "//AudioAssets/AudAsset" : "//VoiceAssets/voiAsset"));
     $lastTimestamp = 0;
     $real_start_byte = 0;
     // the start byte of the current clip in the final merged stream
     $calculated_total_bytes = 0;
     // use the entryPool and a 2-pass iteration to reduce the hits to the DB
     $id_list = array();
     $entry_pool = new entryPool();
     // first pass - populate the entryPool in a single request to the DB
     self::log(__METHOD__, "Before assets");
     foreach ($assets as $asset) {
         $type = $asset->getAttribute("type");
         if ($type != "VIDEO" && $type != "AUDIO") {
             continue;
         }
         // fetch the file name from the DB
         $asset_id = $asset->getAttribute("k_id");
         $id_list[] = $asset_id;
     }
     self::log(__METHOD__, "After assets", count($id_list), $id_list);
     if ($id_list) {
         $entry_pool->addEntries(entryPeer::retrieveByPKsNoFilter($id_list));
     }
     // second pass - the entryPool is supposed to already be populated
     $was_modified = false;
     foreach ($assets as $asset) {
         // fix only VIDEO assets
         $type = $asset->getAttribute("type");
         if ($type != "VIDEO" && $type != "AUDIO") {
             continue;
         }
         // fetch the file name from the DB
         $asset_id = $asset->getAttribute("k_id");
         self::log(__METHOD__, "in loop", $asset_id);
         //$entry = entryPeer::retrieveByPKNoFilter( $asset_id );
         $entry = $entry_pool->retrieveByPK($asset_id);
         // is supposed to exist already in the pool
         if ($entry == NULL) {
             // set an error on the asset element
             $asset->setAttribute("fix_status", "error in k_id [{$asset_id}]");
             $was_modified = true;
             continue;
         } elseif ($entry->getStatus() == entryStatus::DELETED) {
             // set an error on the asset element
             $asset->setAttribute("fix_status", "error in k_id [{$asset_id}] - asset was deleted");
             $was_modified = true;
             continue;
         }
         $file_name = null;
         //TODO: need to work on only an FLV asset
         $flavor_asset_play = assetPeer::retrieveBestPlayByEntryId($entry->getId());
         if (!$flavor_asset_play) {
             KalturaLog::log(__METHOD__ . ' ' . __LINE__ . ' no play flavor asset for entry ' . $entry->getId());
         } else {
             $file_name = kFileSyncUtils::getReadyLocalFilePathForKey($flavor_asset_play->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
         }
         $use_multi_flavor = false;
         $flv_file_name_edit = false;
         $flavor_asset_edit = assetPeer::retrieveBestEditByEntryId($entry->getId());
         if (!$flavor_asset_edit) {
             KalturaLog::log(__METHOD__ . ' ' . __LINE__ . ' no edit flavor asset for entry ' . $entry->getId());
         } else {
             $flv_file_name_edit = kFileSyncUtils::getReadyLocalFilePathForKey($flavor_asset_edit->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET));
             $use_multi_flavor = $flv_file_name_edit && file_exists($flv_file_name_edit) && $timeline == "video";
         }
         if (!$flv_file_name_edit && !$file_name) {
             KalturaLog::log(__METHOD__ . ' ' . __LINE__ . ' no edit & play flavor assets for entry ' . $entry->getId());
             continue;
         }
         $flv_file_name = kFile::fixPath($file_name);
         $stream_info_list = $asset->getElementsByTagName("StreamInfo");
         foreach ($stream_info_list as $stream_info) {
             $file_name = "?";
             try {
                 $stream_info->setAttribute("file_name", kFileSyncUtils::getReadyLocalFilePathForKey($flavor_asset_play->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET)));
                 // replaced__getDataPath
                 $start_byte = $stream_info->getAttribute("start_byte");
                 $end_byte = $stream_info->getAttribute("end_byte");
                 $total_bytes = $stream_info->getAttribute("total_bytes");
                 if ($start_byte == NULL) {
                     $start_byte = self::MISSING_VALUE;
                 }
//.........这里部分代码省略.........
开发者ID:GElkayam,项目名称:server,代码行数:101,代码来源:myFlvStreamer.class.php

示例5: createWidgetImage

 public static function createWidgetImage($entry, $create)
 {
     $contentPath = myContentStorage::getFSContentRootPath();
     $path = kFile::fixPath($contentPath . $entry->getWidgetImagePath());
     // if the create flag is not set and the file doesnt exist exit
     // e.g. the roughcut name has change, we update the image only if it was already in some widget
     if (!$create && !file_exists($path)) {
         return;
     }
     $im = imagecreatetruecolor(400, 30);
     $color = imagecolorallocate($im, 188, 230, 99);
     $font = SF_ROOT_DIR . '/web/ttf/arial.ttf';
     imagettftext($im, 12, 0, 10, 21, $color, $font, $entry->getName());
     myContentStorage::fullMkdir($path);
     imagegif($im, $path);
     imagedestroy($im);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:17,代码来源:myEntryUtils.class.php

示例6: __construct

 public function __construct($original_flv_file_name)
 {
     $original_flv_file_name = kFile::fixPath($original_flv_file_name);
     $this->file_name = $original_flv_file_name . $this->FILE_SUFFIX;
     $this->creating = false;
     // check if the info file exists and is newer than the original
     if (file_exists($this->file_name)) {
         $orig_mtime = filemtime($original_flv_file_name);
         $info_mtime = filemtime($this->file_name);
         if ($info_mtime < $orig_mtime) {
             $this->creating = true;
         } else {
             // load from disk - replace the dynamic variables
         }
     } else {
         $this->creating = true;
         // TODO - remove !!
         $this->sizeList = array();
         $this->keyframeTimes = array();
         $this->keyframeBytes = array();
     }
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:22,代码来源:__myFlvWrapper.class.php

示例7: getMySpaceLogPath

 public static function getMySpaceLogPath()
 {
     $tmp_dir = getenv("TEMP");
     if (empty($tmp_dir)) {
         $tmp_dir = "/tmp";
     }
     $path = kFile::fixPath($tmp_dir . DIRECTORY_SEPARATOR . "kaltura/myspace/logs/");
     return $path;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:9,代码来源:___mySpaceUpdater.class.php


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