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


PHP myContentStorage::fileExtNeedConversion方法代码示例

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


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

示例1: uploadFileByToken

 public static function uploadFileByToken($file_data, $token, $filename, $extra_id = null, $create_thumb = false)
 {
     KalturaLog::log("Trace while uploading1 [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true));
     $origFilename = @$file_data['name'];
     if (!$origFilename) {
         KalturaLog::log("Error while uploading, file does not have a name. [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true) . "\nerror: [" . @$file_data["error"] . "]");
         return;
     }
     $parts = pathinfo($origFilename);
     $extension = @strtolower($parts['extension']);
     /*
     		$filename = $token .'_'. $filename;
     		// add the file extension after the "." character
     		$fullPath = myContentStorage::getFSUploadsPath().$filename . ( $extra_id ? "_" . $extra_id : "" ) .".".$extension;
     */
     list($fullPath, $fullUrl) = self::getUploadPathAndUrl($token, $filename, $extra_id, $extension);
     KalturaLog::log("Trace while uploading2 [{$filename}] [{$token}] [{$extra_id}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
     // start tracking what will hopefully become an entry
     $te = new TrackEntry();
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_UPLOADED_FILE);
     $te->setParam1Str($token);
     $te->setParam2Str($filename);
     $te->setParam3Str($fullPath);
     $te->setDescription(__METHOD__ . ":" . __LINE__);
     TrackEntry::addTrackEntry($te);
     myContentStorage::fullMkdir($fullPath);
     if (!move_uploaded_file($file_data['tmp_name'], $fullPath)) {
         KalturaLog::log("Error while uploading [{$token}] [{$filename}] [{$extra_id}] [{$create_thumb}] " . print_r($file_data, true) . "\n->[{$fullPath}]");
         $err = array("token" => $token, "filename" => $filename, "origFilename" => $origFilename, "error" => @$file_data["error"]);
         KalturaLog::log("Error while uploading [{$token}] [{$filename}] [{$extra_id}] [{$create_thumb}] " . print_r($file_data, true) . "\n->[{$fullPath}]" . "\n" . print_r($err, true));
         return $err;
     }
     chmod($fullPath, 0777);
     $upload_server_header = isset($_SERVER["HTTP_X_KALTURA_SERVER"]) ? $_SERVER["HTTP_X_KALTURA_SERVER"] : null;
     $thumb_created = false;
     // if the file originated from a kaltura upload server we dont need a thumbnail (kuploader)
     if ($create_thumb && !$upload_server_header) {
         $thumbFullPath = self::getThumbnailPath($fullPath, ".jpg");
         kFile::fullMkdir($thumbFullPath);
         KalturaLog::log("Thumbnail full path [{$thumbFullPath}]");
         if (myContentStorage::fileExtAccepted($extension)) {
             KalturaLog::log("Generating image thumbnail");
             myFileConverter::createImageThumbnail($fullPath, $thumbFullPath, "image2");
             $thumb_url = self::getThumbnailPath($fullUrl, ".jpg");
             $thumb_created = file_exists($thumbFullPath);
         } elseif (myContentStorage::fileExtNeedConversion($extension)) {
             KalturaLog::log("Generating media thumbnail");
             myFileConverter::captureFrame($fullPath, $thumbFullPath, 1, "image2", -1, -1, 3);
             if (!file_exists($thumbFullPath)) {
                 myFileConverter::captureFrame($fullPath, $thumbFullPath, 1, "image2", -1, -1, 0);
             }
         }
     }
     if (!$thumb_created) {
         KalturaLog::log("Thumbnail not generated");
         // in this case no thumbnail was created - don't extract false data
         $thumb_url = "";
     }
     return array("token" => $token, "filename" => $filename, "origFilename" => $origFilename, "thumb_url" => $thumb_url, "thumb_created" => $thumb_created);
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:60,代码来源:myUploadUtils.class.php


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