本文整理汇总了PHP中entry::setMediaDate方法的典型用法代码示例。如果您正苦于以下问题:PHP entry::setMediaDate方法的具体用法?PHP entry::setMediaDate怎么用?PHP entry::setMediaDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entry
的用法示例。
在下文中一共展示了entry::setMediaDate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: entryHandled
public function entryHandled(entry $dbEntry)
{
$srcEntry = entryPeer::retrieveByPK($this->entryId);
if ($srcEntry->getType() == KalturaEntryType::MEDIA_CLIP && $dbEntry->getType() == KalturaEntryType::MEDIA_CLIP && $dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$dbEntry->setDimensions($srcEntry->getWidth(), $srcEntry->getHeight());
$dbEntry->setMediaDate($srcEntry->getMediaDate(null));
$dbEntry->save();
} else {
$srcFlavorAsset = null;
if (is_null($this->flavorParamsId)) {
$srcFlavorAsset = assetPeer::retrieveOriginalByEntryId($this->entryId);
} else {
$srcFlavorAsset = assetPeer::retrieveByEntryIdAndParams($this->entryId, $this->flavorParamsId);
}
if ($srcFlavorAsset) {
$dbEntry->setDimensions($srcFlavorAsset->getWidth(), $srcFlavorAsset->getHeight());
$dbEntry->save();
}
}
}
return parent::entryHandled($dbEntry);
}
示例2: attachFile
/**
* @param string $entryFullPath
* @param entry $dbEntry
* @param asset $dbAsset
* @return asset
* @throws KalturaErrors::UPLOAD_TOKEN_INVALID_STATUS_FOR_ADD_ENTRY
* @throws KalturaErrors::UPLOADED_FILE_NOT_FOUND_BY_TOKEN
*/
protected function attachFile($entryFullPath, entry $dbEntry, asset $dbAsset = null, $copyOnly = false)
{
// TODO - move image handling to media service
if ($dbEntry->getMediaType() == KalturaMediaType::IMAGE) {
$exifImageType = @exif_imagetype($entryFullPath);
$validTypes = array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM, IMAGETYPE_IFF, IMAGETYPE_PNG);
if (in_array($exifImageType, $validTypes)) {
$exifData = @exif_read_data($entryFullPath);
if ($exifData && isset($exifData["DateTimeOriginal"]) && $exifData["DateTimeOriginal"]) {
$mediaDate = $exifData["DateTimeOriginal"];
$ts = strtotime($mediaDate);
// handle invalid dates either due to bad format or out of range
if ($ts === -1 || $ts === false || $ts < strtotime('2000-01-01') || $ts > strtotime('2015-01-01')) {
$mediaDate = null;
}
$dbEntry->setMediaDate($mediaDate);
}
}
list($width, $height, $type, $attr) = getimagesize($entryFullPath);
$dbEntry->setDimensions($width, $height);
$dbEntry->setData(".jpg");
// this will increase the data version
$dbEntry->save();
$syncKey = $dbEntry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_DATA);
try {
kFileSyncUtils::moveFromFile($entryFullPath, $syncKey, true, $copyOnly);
} catch (Exception $e) {
if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
throw $e;
}
$dbEntry->setStatus(entryStatus::READY);
$dbEntry->save();
return null;
}
$isNewAsset = false;
if (!$dbAsset) {
$isNewAsset = true;
$dbAsset = kFlowHelper::createOriginalFlavorAsset($this->getPartnerId(), $dbEntry->getId());
}
if (!$dbAsset && $dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
$ext = pathinfo($entryFullPath, PATHINFO_EXTENSION);
$dbAsset->setFileExt($ext);
$dbAsset->save();
if ($dbAsset && $dbAsset instanceof thumbAsset) {
list($width, $height, $type, $attr) = getimagesize($entryFullPath);
$dbAsset->setWidth($width);
$dbAsset->setHeight($height);
$dbAsset->save();
}
$syncKey = $dbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
try {
kFileSyncUtils::moveFromFile($entryFullPath, $syncKey, true, $copyOnly);
} catch (Exception $e) {
if ($dbEntry->getStatus() == entryStatus::NO_CONTENT) {
$dbEntry->setStatus(entryStatus::ERROR_CONVERTING);
$dbEntry->save();
}
$dbAsset->setStatus(flavorAsset::FLAVOR_ASSET_STATUS_ERROR);
$dbAsset->save();
throw $e;
}
if ($dbAsset && !$dbAsset instanceof flavorAsset) {
$dbAsset->setStatusLocalReady();
if ($dbAsset->getFlavorParamsId()) {
$dbFlavorParams = assetParamsPeer::retrieveByPK($dbAsset->getFlavorParamsId());
if ($dbFlavorParams) {
$dbAsset->setTags($dbFlavorParams->getTags());
}
}
$dbAsset->save();
}
if ($isNewAsset) {
kEventsManager::raiseEvent(new kObjectAddedEvent($dbAsset));
}
kEventsManager::raiseEvent(new kObjectDataChangedEvent($dbAsset));
return $dbAsset;
}
示例3: handleEntry
//.........这里部分代码省略.........
}
// for videos - thumbail should be created in post convert
// otherwise this code will fail if the thumbanil wasn't created successfully (roman)
//myFileConverter::autoCaptureFrame($entry_fullPath, $thumbTempPrefix."big_", $thumbTime, -1, -1);
$need_thumb = false;
$thumbBigFullPath = $thumbTempPrefix . "big_" . $entry_thumbNum . '.jpg';
}
}
//else select existing thumb ($entry_thumbNum already points to the right thumbnail)
}
}
$thumbFullPath = $thumbTempPrefix . $entry_thumbNum . '.jpg';
// if we arrived here both entry and thumbnail are valid we can now update the db
// in order to have the final entry_id and move its data to its final destination
if ($onlyExtractThumb) {
return $thumbFullPath;
}
}
$entry->setkshowId($this->kshow_id);
$entry->setKuserId($kuser_id);
$entry->setCreatorKuserId($kuser_id);
if ($this->partner_id != null) {
$entry->setPartnerId($this->partner_id);
$entry->setSubpId($this->subp_id);
}
$entry->setName($name ? $name : $this->getParam('entry_name'));
// $entry->setDescription('');//$this->getParam('entry_description'));
$entry->setType($type);
$entry->setMediaType($media_type);
$entry->setTags($tags ? $tags : $this->getParam('entry_tags'));
$entry->setSource($media_source);
$entry->setSourceId($this->getParam('entry_media_id'));
if ($media_date) {
$entry->setMediaDate($media_date);
}
// if source_link wasnt given use the entry_url HOWEVER, use it only if id doesnt contain @ which suggests the use of a password
$entry->setSourceLink($entry_source_link ? $entry_source_link : (strstr($entry_url, '@') ? "" : $entry_url));
if ($media_source == entry::ENTRY_MEDIA_SOURCE_FILE) {
$entry->setSourceLink("file:{$entry_fullPath}");
}
$entry->setLicenseType($this->getParam('entry_license'));
$entry->setCredit($this->getParam('entry_credit'));
$entry->setStatus($entry_status);
if ($duration !== null) {
$entry->setLengthInMsecs($duration);
}
if ($this->entry_id == 0) {
$entry->save();
$this->entry_id = $entry->getId();
}
// move thumb to final destination and set db entry
if ($media_type != entry::ENTRY_MEDIA_TYPE_AUDIO && $entry_thumbNum && $need_thumb) {
KalturaLog::debug("handleEntry: saving none audio thumb [{$thumbBigFullPath}]");
$entry->setThumbnail('.jpg');
if ($thumbBigFullPath) {
if ($media_type != entry::ENTRY_MEDIA_TYPE_IMAGE) {
myFileConverter::convertImage($thumbBigFullPath, $thumbFullPath);
}
/*$thumbBigFinalPath = $content.$entry->getBigThumbnailPath();
myContentStorage::moveFile($thumbBigFullPath, $thumbBigFinalPath, true , $should_copy );
*/
$entryThumbKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
try {
if (!$should_copy) {
kFileSyncUtils::moveFromFile($thumbBigFullPath, $entryThumbKey);
} else {
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:67,代码来源:myInsertEntryHelper.class.php