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


PHP myContentStorage::getFSUploadsPath方法代码示例

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


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

示例1: addParseCaptionAssetJob

 /**
  * @param CaptionAsset $captionAsset
  * @param BatchJob $parentJob
  * @throws kCoreException FILE_NOT_FOUND
  * @return BatchJob
  */
 public function addParseCaptionAssetJob(CaptionAsset $captionAsset, BatchJob $parentJob = null)
 {
     $syncKey = $captionAsset->getSyncKey(asset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     $fileSync = kFileSyncUtils::getReadyInternalFileSyncForKey($syncKey);
     if (!$fileSync) {
         if (!PermissionPeer::isValidForPartner(CaptionPermissionName::IMPORT_REMOTE_CAPTION_FOR_INDEXING, $captionAsset->getPartnerId())) {
             throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
         }
         $fileSync = kFileSyncUtils::getReadyExternalFileSyncForKey($syncKey);
         if (!$fileSync) {
             throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
         }
         $fullPath = myContentStorage::getFSUploadsPath() . '/' . $captionAsset->getId() . '.tmp';
         if (!kFile::downloadUrlToFile($fileSync->getExternalUrl($captionAsset->getEntryId()), $fullPath)) {
             throw new kCoreException("File sync not found: {$syncKey}", kCoreException::FILE_NOT_FOUND);
         }
         kFileSyncUtils::moveFromFile($fullPath, $syncKey, true, false, true);
     }
     $jobData = new kParseCaptionAssetJobData();
     $jobData->setCaptionAssetId($captionAsset->getId());
     $batchJob = null;
     if ($parentJob) {
         $batchJob = $parentJob->createChild();
     } else {
         $batchJob = new BatchJob();
         $batchJob->setEntryId($captionAsset->getEntryId());
         $batchJob->setPartnerId($captionAsset->getPartnerId());
     }
     return kJobsManager::addJob($batchJob, $jobData, CaptionSearchPlugin::getBatchJobTypeCoreValue(CaptionSearchBatchJobType::PARSE_CAPTION_ASSET));
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:36,代码来源:kCaptionSearchFlowManager.php

示例2: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kLocalFileResource();
     }
     file_put_contents($fname = tempnam(myContentStorage::getFSUploadsPath(), "KFR"), $this->content);
     $object_to_fill->setLocalFilePath($fname);
     $object_to_fill->setSourceType(entry::ENTRY_MEDIA_SOURCE_TEXT);
     return parent::toObject($object_to_fill, $props_to_skip);
 }
开发者ID:DBezemer,项目名称:server,代码行数:10,代码来源:KalturaStringResource.php

示例3: toObject

 public function toObject($object_to_fill = null, $props_to_skip = array())
 {
     if (!$object_to_fill) {
         $object_to_fill = new kLocalFileResource();
     }
     $ext = pathinfo($this->fileData['name'], PATHINFO_EXTENSION);
     $uploadPath = $this->fileData['tmp_name'];
     $tempPath = myContentStorage::getFSUploadsPath() . '/' . uniqid(time()) . '.' . $ext;
     $moved = kFile::moveFile($uploadPath, $tempPath, true);
     if (!$moved) {
         throw new KalturaAPIException(KalturaErrors::UPLOAD_ERROR);
     }
     $object_to_fill->setLocalFilePath($tempPath);
     return $object_to_fill;
 }
开发者ID:DBezemer,项目名称:server,代码行数:15,代码来源:KalturaUploadedFileResource.php

示例4: getUploadPathAndUrl

 public static function getUploadPathAndUrl($token, $file_alias, $extra_id = null, $extension = "")
 {
     //		$extension = ""; // strtolower($parts['extension']);
     $filename = $token . '_' . $file_alias;
     // add the file extension after the "." character
     $suffix = $filename . ($extra_id ? "_" . $extra_id : "") . "." . $extension;
     $fullPath = myContentStorage::getFSUploadsPath() . $suffix;
     $fullUrl = requestUtils::getRequestHost() . "/" . myContentStorage::getFSUploadsPath(false) . $suffix;
     return array($fullPath, $fullUrl);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:10,代码来源:myUploadUtils.class.php

示例5: attachUrlResource

 /**
  * @param kUrlResource $resource
  * @param entry $dbEntry
  * @param asset $dbAsset
  * @return asset
  */
 protected function attachUrlResource(kUrlResource $resource, entry $dbEntry, asset $dbAsset = null)
 {
     if ($dbAsset instanceof flavorAsset) {
         $dbEntry->setSource(KalturaSourceType::URL);
         $dbEntry->save();
     }
     $url = $resource->getUrl();
     if (!$resource->getForceAsyncDownload()) {
         // TODO - move image handling to media service
         if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
             $entryFullPath = myContentStorage::getFSUploadsPath() . '/' . $dbEntry->getId() . '.jpg';
             if (KCurlWrapper::getDataFromFile($url, $entryFullPath)) {
                 return $this->attachFile($entryFullPath, $dbEntry, $dbAsset);
             }
             KalturaLog::err("Failed downloading file[{$url}]");
             $dbEntry->setStatus(entryStatus::ERROR_IMPORTING);
             $dbEntry->save();
             return null;
         }
         if ($dbAsset && !$dbAsset instanceof flavorAsset) {
             $ext = pathinfo($url, PATHINFO_EXTENSION);
             $entryFullPath = myContentStorage::getFSUploadsPath() . '/' . $dbEntry->getId() . '.' . $ext;
             if (KCurlWrapper::getDataFromFile($url, $entryFullPath)) {
                 $dbAsset = $this->attachFile($entryFullPath, $dbEntry, $dbAsset);
                 return $dbAsset;
             }
             KalturaLog::err("Failed downloading file[{$url}]");
             $dbAsset->setStatus(asset::FLAVOR_ASSET_STATUS_ERROR);
             $dbAsset->save();
             return null;
         }
     }
     kJobsManager::addImportJob(null, $dbEntry->getId(), $this->getPartnerId(), $url, $dbAsset, null, $resource->getImportJobData());
     return $dbAsset;
 }
开发者ID:DBezemer,项目名称:server,代码行数:41,代码来源:KalturaEntryService.php

示例6: createImageByFile

 public static function createImageByFile($source_file)
 {
     global $global_kaltura_memory_limit;
     if (!isset($global_kaltura_memory_limit)) {
         ini_set("memory_limit", "256M");
     }
     if (!file_exists($source_file)) {
         KalturaLog::log("file not found [{$source_file}]");
         return null;
     }
     if (!is_file($source_file)) {
         KalturaLog::log("path is not file [{$source_file}]");
         return null;
     }
     list($sourcewidth, $sourceheight, $type, $attr) = getimagesize($source_file);
     $srcIm = NULL;
     switch ($type) {
         case IMAGETYPE_JPEG:
             $srcIm = imagecreatefromjpeg($source_file);
             break;
         case IMAGETYPE_PNG:
             $srcIm = imagecreatefrompng($source_file);
             break;
         case IMAGETYPE_GIF:
             $srcIm = imagecreatefromgif($source_file);
             break;
         case IMAGETYPE_WBMP:
             $srcIm = imagecreatefromwbmp($source_file);
             break;
         default:
             $srcIm = NULL;
     }
     if (!$srcIm) {
         $output = array();
         $cmd = kConf::get("bin_path_imagemagick");
         $jpeg_file = myContentStorage::getFSUploadsPath(true) . pathinfo($source_file, PATHINFO_FILENAME) . ".jpg";
         $validInput = true;
         $validInput &= realpath($source_file) !== FALSE;
         if (!$validInput) {
             throw new Exception("Illegal input was given");
         }
         exec($cmd . " \"{$source_file}\" \"{$jpeg_file}\"", $output);
         if (file_exists($jpeg_file)) {
             list($sourcewidth, $sourceheight, $type, $attr) = getimagesize($jpeg_file);
             $srcIm = imagecreatefromjpeg($jpeg_file);
         }
         //fixme echo ('myFileConverter::createImageByFile - file extension not supported: '.$source_file.' type:'.$type );
     }
     // if image failed to load return a null result instead of an errornous one due to a bad file
     if (!$srcIm) {
         return array(0, 0, IMAGETYPE_JPEG, "", null);
     }
     return array($sourcewidth, $sourceheight, $type, $attr, $srcIm);
 }
开发者ID:DBezemer,项目名称:server,代码行数:54,代码来源:myFileConverter.class.php

示例7: addFromUploadedFileAction

 /**
  * Add new entry after the specific media file was uploaded and the upload token id exists
  *
  * @action addFromUploadedFile
  * @param KalturaMediaEntry $mediaEntry Media entry metadata
  * @param string $uploadTokenId Upload token id
  * @return KalturaMediaEntry The new media entry
  *
  * @throws KalturaErrors::PROPERTY_VALIDATION_MIN_LENGTH
  * @throws KalturaErrors::PROPERTY_VALIDATION_CANNOT_BE_NULL
  * @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
  *
  * @deprecated use media.add instead
  */
 function addFromUploadedFileAction(KalturaMediaEntry $mediaEntry, $uploadTokenId)
 {
     if ($mediaEntry->conversionQuality && !$mediaEntry->conversionProfileId) {
         $mediaEntry->conversionProfileId = $mediaEntry->conversionQuality;
     }
     try {
         // check that the uploaded file exists
         $entryFullPath = kUploadTokenMgr::getFullPathByUploadTokenId($uploadTokenId);
         // Make sure that the uploads path is not modified by $uploadTokenId (with the value of "../" for example )
         $entryRootDir = realpath(dirname($entryFullPath));
         $uploadPathBase = realpath(myContentStorage::getFSUploadsPath());
         if (strpos($entryRootDir, $uploadPathBase) !== 0) {
             KalturaLog::err("uploadTokenId [{$uploadTokenId}] points outside of uploads directory");
             throw new KalturaAPIException(KalturaErrors::INVALID_UPLOAD_TOKEN_ID);
         }
     } catch (kCoreException $ex) {
         if ($ex->getCode() == kUploadTokenException::UPLOAD_TOKEN_INVALID_STATUS) {
         }
         throw new KalturaAPIException(KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY);
         throw $ex;
     }
     if (!file_exists($entryFullPath)) {
         // Backward compatability - support case in which the required file exist in the other DC
         kFileUtils::dumpApiRequest(kDataCenterMgr::getRemoteDcExternalUrlByDcId(1 - kDataCenterMgr::getCurrentDcId()));
         /*
         $remoteDCHost = kUploadTokenMgr::getRemoteHostForUploadToken($uploadTokenId, kDataCenterMgr::getCurrentDcId());
         if($remoteDCHost)
         {
         	kFileUtils::dumpApiRequest($remoteDCHost);
         }
         else
         {
         	throw new KalturaAPIException(KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN);
         }
         */
     }
     $dbEntry = parent::add($mediaEntry, $mediaEntry->conversionProfileId);
     $kshowId = $dbEntry->getKshowId();
     // setup the needed params for my insert entry helper
     $paramsArray = array("entry_media_source" => KalturaSourceType::FILE, "entry_media_type" => $dbEntry->getMediaType(), "entry_full_path" => $entryFullPath, "entry_license" => $dbEntry->getLicenseType(), "entry_credit" => $dbEntry->getCredit(), "entry_source_link" => $dbEntry->getSourceLink(), "entry_tags" => $dbEntry->getTags());
     $token = $this->getKsUniqueString();
     $insert_entry_helper = new myInsertEntryHelper(null, $dbEntry->getKuserId(), $kshowId, $paramsArray);
     $insert_entry_helper->setPartnerId($this->getPartnerId(), $this->getPartnerId() * 100);
     $insert_entry_helper->insertEntry($token, $dbEntry->getType(), $dbEntry->getId(), $dbEntry->getName(), $dbEntry->getTags(), $dbEntry);
     $dbEntry = $insert_entry_helper->getEntry();
     kUploadTokenMgr::closeUploadTokenById($uploadTokenId);
     $ret = new KalturaMediaEntry();
     if ($dbEntry) {
         myNotificationMgr::createNotification(kNotificationJobData::NOTIFICATION_TYPE_ENTRY_ADD, $dbEntry, $dbEntry->getPartnerId(), null, null, null, $dbEntry->getId());
         $ret->fromObject($dbEntry, $this->getResponseProfile());
     }
     return $ret;
 }
开发者ID:AdiTal,项目名称:server,代码行数:67,代码来源:MediaService.php

示例8: handleEntry

 private function handleEntry($onlyExtractThumb, $prefix, $type, $entry_id, $name = null, $tags = null, $entry = null)
 {
     KalturaLog::debug("handleEntry({$type}, {$entry_id}, {$name})");
     $this->clear($prefix, $entry_id);
     $kuser_id = $this->kuser_id;
     $entry_data_prefix = $kuser_id . '_' . ($prefix == '' ? 'data' : rtrim($prefix, '_'));
     $uploads = myContentStorage::getFSUploadsPath();
     $content = myContentStorage::getFSContentRootPath();
     $media_source = $this->getParam('entry_media_source');
     $media_type = $this->getParam('entry_media_type');
     $entry_url = $this->getParam('entry_url');
     $entry_source_link = $this->getParam('entry_source_link');
     $entry_fileName = $this->getParam('entry_data');
     $entry_thumbNum = $this->getParam('entry_thumb_num', 0);
     $entry_thumbUrl = $this->getParam('entry_thumb_url', '');
     $should_copy = $this->getParam('should_copy', false);
     $skip_conversion = $this->getParam('skip_conversion', false);
     $webcam_suffix = $this->getParam('webcam_suffix', '');
     $duration = $this->getParam('duration', null);
     $entry_fullPath = "";
     $ext = null;
     $entry = null;
     if ($entry_id) {
         $entry = entryPeer::retrieveByPK($entry_id);
     } else {
         $entry = new entry();
     }
     $this->entry = $entry;
     $entry_status = $entry->getStatus();
     if (is_null($entry_status)) {
         $entry_status = entryStatus::READY;
     }
     // by the end of this block of code $entry_fullPath will point to the location of the entry
     // the entry status will be set (IMPORT / PRECONVERT / READY)
     // a background image is always previewed by the user no matter what source he used
     // so the entry is already in the /uploads directory
     // continue tracking the file upload
     $te = new TrackEntry();
     $te->setEntryId($entry_id);
     $te->setTrackEventTypeId(TrackEntry::TRACK_ENTRY_EVENT_TYPE_ADD_ENTRY);
     KalturaLog::debug("handleEntry: media_source: {$media_source}, prefix: {$prefix}");
     if ($media_source == entry::ENTRY_MEDIA_SOURCE_FILE || $prefix == 'bg_') {
         $full_path = $this->getParam('entry_full_path');
         if ($full_path) {
             $entry_fullPath = $full_path;
         } else {
             $entry_fullPath = $uploads . $entry_data_prefix . strrchr($entry_fileName, '.');
         }
         if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO || $media_type == entry::ENTRY_MEDIA_TYPE_AUDIO) {
             $entry_status = entryStatus::PRECONVERT;
         }
         $te->setParam3Str($entry_fullPath);
         $te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_FILE");
     } else {
         if ($media_source == entry::ENTRY_MEDIA_SOURCE_WEBCAM) {
             // set $entry_fileName to webcam output file and flag that conversion is not needed
             $webcam_basePath = $content . '/content/webcam/' . ($webcam_suffix ? $webcam_suffix : 'my_recorded_stream_' . $kuser_id);
             $entry_fullPath = $webcam_basePath . '.' . kWAMSWebcam::OUTPUT_FILE_EXT;
             $ext = kWAMSWebcam::OUTPUT_FILE_EXT;
             if (file_exists($entry_fullPath)) {
                 // continue tracking the webcam
                 $te->setParam3Str($entry_fullPath);
                 $te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_WEBCAM");
             } else {
                 KalturaLog::err("File [{$entry_fullPath}] does not exist");
                 $entry_status = entryStatus::ERROR_IMPORTING;
             }
         } else {
             // if the url ends with .ext, we'll extract it this way
             $urlext = strrchr($entry_url, '.');
             // TODO: fix this patch
             if (strlen($urlext) > 4) {
                 $urlext = '.jpg';
             }
             // if we got something wierd, assume we're downloading a jpg
             $entry_fileName = $entry_data_prefix . $urlext;
             KalturaLog::debug("handleEntry: media_type: {$media_type}");
             if ($media_type == entry::ENTRY_MEDIA_TYPE_IMAGE) {
                 $duration = 0;
                 $entry_fullPath = $uploads . $entry_fileName;
                 if (!kFile::downloadUrlToFile($entry_url, $entry_fullPath)) {
                     KalturaLog::debug("Failed downloading file[{$entry_url}]");
                     $entry_status = entryStatus::ERROR_IMPORTING;
                 }
                 // track images
                 $te->setParam3Str($entry_fullPath);
                 $te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_URL:ENTRY_MEDIA_TYPE_IMAGE");
             } else {
                 if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO) {
                     //fixme - we can extract during import
                     $ext = "flv";
                 } else {
                     $ext = "mp3";
                 }
                 $entry_status = entryStatus::IMPORT;
                 // track images
                 $te->setParam3Str($ext);
                 $te->setDescription(__METHOD__ . ":" . __LINE__ . "::ENTRY_MEDIA_SOURCE_URL:ENTRY_MEDIA_TYPE_VIDEO");
             }
         }
//.........这里部分代码省略.........
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:101,代码来源:myInsertEntryHelper.class.php

示例9: removeTempKUserContent

 public static function removeTempKUserContent($kuser_id)
 {
     $filePattern = myContentStorage::getFSUploadsPath() . $kuser_id . '_*.*';
     foreach (glob($filePattern) as $filename) {
         unlink($filename);
     }
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:7,代码来源:myContentStorage.class.php

示例10: myMailAttachmentImporter

}

</script>
<h1>Recent MMS uploads</h1>

<?php 
require_once 'myMailAttachmentImporter.class.php';
$host = "mail.kaltura.com";
//  imap host
$login = "mobile@kaltura.com";
//imap  login
$password = "passme";
//imap password
$importer = new myMailAttachmentImporter();
// Creating instance of class####
$importedMessageDataArray = $importer->getdata($host, $login, $password, myContentStorage::getFSUploadsPath());
if ($importedMessageDataArray != null) {
    echo 'Number of messages in mailbox ' . $login . ': ' . count($importedMessageDataArray);
    echo '<hr>';
    foreach ($importedMessageDataArray as $importedMessageData) {
        echo 'subject:' . $importedMessageData["subject"] . '<BR>';
        echo 'from:' . $importedMessageData["fromaddress"] . '<BR>';
        echo 'date:' . $importedMessageData["date"] . '<BR>';
        echo 'body:' . $importedMessageData["body"] . '<BR>';
        if ($importedMessageData["attachment"]) {
            echo 'type = ' . $importedMessageData["attachment"]["type"] . '/' . $importedMessageData["attachment"]["subtype"] . '<BR>';
            if ($importedMessageData["attachment"]["type"] == 'image') {
                echo '<img width="100" width="100" src="/content/uploads/' . $importedMessageData["attachment"]["filename"] . '"><BR>';
            } else {
                echo '<img width="100" width="100" src="/content/uploads/' . $importedMessageData["attachment"]["thumbnail"] . '">';
                echo '<a href="/content/uploads/' . $importedMessageData["attachment"]["filename"] . '">download file</a>';
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:31,代码来源:checkAttachmentImportSuccess.php

示例11: createThumbnailFromEntry

 public static function createThumbnailFromEntry(entry $entry, entry $source_entry, $time_offset, $flavorParamsId = null)
 {
     $media_type = $source_entry->getMediaType();
     // should capture thumbnail from video
     if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO && $time_offset != -1) {
         $flavorAsset = null;
         if ($flavorParamsId) {
             $flavorAsset = flavorAssetPeer::retrieveByEntryIdAndFlavorParams($source_entry->getId(), $flavorParamsId);
         }
         if (is_null($flavorAsset) || $flavorAsset->getStatus() != flavorAsset::FLAVOR_ASSET_STATUS_READY) {
             $flavorAsset = flavorAssetPeer::retrieveOriginalByEntryId($source_entry->getId());
         }
         if (is_null($flavorAsset)) {
             $flavorAsset = flavorAssetPeer::retrieveHighestBitrateByEntryId($source_entry->getId());
         }
         if (is_null($flavorAsset)) {
             throw new Exception("Flavor asset not found");
         }
         $flavorSyncKey = $flavorAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
         if (!$flavorSyncKey) {
             return false;
         }
         $dataPath = kFileSyncUtils::getReadyLocalFilePathForKey($flavorSyncKey);
         $tempPath = myContentStorage::getFSUploadsPath();
         $tempThumbPrefix = $tempPath . "temp_thumb" . microtime(true);
         $thumbBigFullPath = $tempThumbPrefix . "big_1.jpg";
         $thumbFullPath = $tempThumbPrefix . '1.jpg';
         myFileConverter::autoCaptureFrame($dataPath, $tempThumbPrefix . "big_", $time_offset, -1, -1);
         // removed creation of "small thumb" - not in use
         myFileConverter::convertImage($thumbBigFullPath, $thumbFullPath);
         $bigThumbExists = file_exists($thumbBigFullPath) && filesize($thumbBigFullPath);
         if (!$bigThumbExists) {
             return false;
         }
         $entry->setThumbnail(".jpg");
         $entry->save();
         // create new thumb file for entry
         $newThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
         kFileSyncUtils::moveFromFile($thumbBigFullPath, $newThumbKey);
     } else {
         if ($media_type == entry::ENTRY_MEDIA_TYPE_VIDEO && $time_offset == -1 || $media_type == entry::ENTRY_MEDIA_TYPE_SHOW) {
             $thumbBigFullKey = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
             if (!kFileSyncUtils::fileSync_exists($thumbBigFullKey)) {
                 return false;
             }
             $entry->setThumbnail(".jpg");
             $entry->save();
             // copy existing thumb
             $newThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
             kFileSyncUtils::softCopy($thumbBigFullKey, $newThumbKey);
         } elseif ($media_type == entry::ENTRY_MEDIA_TYPE_IMAGE) {
             $thumb_key = $source_entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
             $thumb_path = kFileSyncUtils::getLocalFilePathForKey($thumb_key);
             $entry->setThumbnail(".jpg");
             $entry->save();
             // copy existing thumb
             $newThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
             kFileSyncUtils::copyFromFile($thumb_path, $newThumbKey);
         } else {
             return false;
         }
     }
     self::disableAutoThumbnailCreation($entry->getId());
     return true;
 }
开发者ID:richhl,项目名称:kalturaCE,代码行数:65,代码来源:myEntryUtils.class.php

示例12: saveAttachments

 function saveAttachments($mid)
 {
     $attachments = $this->locateAttachments();
     if (!$attachments) {
         $this->importedMessageDataArray[$mid]["attachment"] = null;
         return;
     }
     $part = $this->getPartByPartNum("1");
     // we will save only the first attachment, which is always in position 2
     $mege = imap_fetchbody($this->mbox, $mid, "2");
     $ext = strtolower($part->subtype);
     if ($ext == 'jpeg') {
         $ext = 'jpg';
     }
     $data = $this->getdecodevalue($mege, $part->encoding);
     $filename = "{$this->savedDirPath}" . $mid . "_attach." . $ext;
     $fp = fopen($filename, "w");
     fputs($fp, $data);
     fclose($fp);
     // now create thumbnail images
     if ($part->type == 5) {
         myFileConverter::createImageThumbnail($filename, "{$this->savedDirPath}" . $mid . "_thumbnail1.jpg", "image2");
         $this->importedMessageDataArray[$mid]["attachment"]["thumbnail"] = $mid . "_thumbnail1.jpg";
     } else {
         if ($part->type == 6) {
             $thumbPrefix = myContentStorage::getFSUploadsPath() . '_thumbnail';
             myFileConverter::captureFrame($filename, "{$this->savedDirPath}" . $mid . "_thumbnail%d.jpg", 1, "image2");
             $this->importedMessageDataArray[$mid]["attachment"]["thumbnail"] = $mid . "_thumbnail1.jpg";
         } else {
             $this->importedMessageDataArray[$mid]["attachment"]["thumbnail"] = "";
         }
     }
     /*
      * TODO: handle the case for audio upload, or other cases where there is no image thumbnail
      */
     $this->importedMessageDataArray[$mid]["attachment"]["type"] = $this->attachmenttype[$part->type];
     $this->importedMessageDataArray[$mid]["attachment"]["subtype"] = strtolower($part->subtype);
     $this->importedMessageDataArray[$mid]["attachment"]["filename"] = $mid . "_attach." . $ext;
 }
开发者ID:DBezemer,项目名称:server,代码行数:39,代码来源:___myMailAttachmentImporter.class.php

示例13: getUploadPath

 /**
  * Returns the target upload path for upload token id and extension
  * @param string $uploadTokenId
  * @param string $extension
  */
 protected function getUploadPath($uploadTokenId, $extension = '')
 {
     if (!$extension) {
         $extension = self::NO_EXTENSION_IDENTIFIER;
     }
     return myContentStorage::getFSUploadsPath() . $uploadTokenId . '.' . $extension;
 }
开发者ID:DBezemer,项目名称:server,代码行数:12,代码来源:kUploadTokenMgr.php

示例14: attachUrl

 /**
  * @param CaptionAsset $captionAsset
  * @param string $url
  */
 protected function attachUrl(CaptionAsset $captionAsset, $url)
 {
     $fullPath = myContentStorage::getFSUploadsPath() . '/' . basename($url);
     if (KCurlWrapper::getDataFromFile($url, $fullPath)) {
         return $this->attachFile($captionAsset, $fullPath);
     }
     if ($captionAsset->getStatus() == CaptionAsset::ASSET_STATUS_QUEUED || $captionAsset->getStatus() == CaptionAsset::ASSET_STATUS_NOT_APPLICABLE) {
         $captionAsset->setDescription("Failed downloading file[{$url}]");
         $captionAsset->setStatus(CaptionAsset::ASSET_STATUS_ERROR);
         $captionAsset->save();
     }
     throw new KalturaAPIException(KalturaCaptionErrors::CAPTION_ASSET_DOWNLOAD_FAILED, $url);
 }
开发者ID:panigh,项目名称:server,代码行数:17,代码来源:CaptionAssetService.php

示例15: attachUrl

 /**
  * @param thumbAsset $thumbAsset
  * @param string $url
  */
 protected function attachUrl(thumbAsset $thumbAsset, $url)
 {
     $fullPath = myContentStorage::getFSUploadsPath() . '/' . $thumbAsset->getId() . '.jpg';
     if (kFile::downloadUrlToFile($url, $fullPath)) {
         return $this->attachFile($thumbAsset, $fullPath);
     }
     if ($thumbAsset->getStatus() == thumbAsset::ASSET_STATUS_QUEUED || $thumbAsset->getStatus() == thumbAsset::ASSET_STATUS_NOT_APPLICABLE) {
         $thumbAsset->setDescription("Failed downloading file[{$url}]");
         $thumbAsset->setStatus(thumbAsset::ASSET_STATUS_ERROR);
         $thumbAsset->save();
     }
     throw new KalturaAPIException(KalturaErrors::THUMB_ASSET_DOWNLOAD_FAILED, $url);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:17,代码来源:ThumbAssetService.php


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