本文整理汇总了PHP中myContentStorage::fileExtAccepted方法的典型用法代码示例。如果您正苦于以下问题:PHP myContentStorage::fileExtAccepted方法的具体用法?PHP myContentStorage::fileExtAccepted怎么用?PHP myContentStorage::fileExtAccepted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myContentStorage
的用法示例。
在下文中一共展示了myContentStorage::fileExtAccepted方法的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);
}