本文整理汇总了PHP中assetPeer::removeThumbAssetDeafultTags方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::removeThumbAssetDeafultTags方法的具体用法?PHP assetPeer::removeThumbAssetDeafultTags怎么用?PHP assetPeer::removeThumbAssetDeafultTags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::removeThumbAssetDeafultTags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: decideThumbGenerate
//.........这里部分代码省略.........
$destThumbParamsOutput = self::validateThumbAndMediaInfo($destThumbParams, $mediaInfo, $errDescription, $srcAsset);
if ($srcAsset->getType() == assetType::FLAVOR && is_null($destThumbParamsOutput->getVideoOffset())) {
$destThumbParamsOutput->setVideoOffset($entry->getThumbOffset());
}
$destThumbParamsOutput->setVideoOffset(min($destThumbParamsOutput->getVideoOffset(), $entry->getDuration()));
if (!$destThumbParamsOutput->getDensity()) {
$partner = $entry->getPartner();
if (!is_null($partner)) {
$destThumbParamsOutput->setDensity($partner->getDefThumbDensity());
}
}
$thumbAsset = assetPeer::retrieveByEntryIdAndParams($entry->getId(), $destThumbParams->getId());
if ($thumbAsset) {
$description = $thumbAsset->getDescription() . "\n" . $errDescription;
$thumbAsset->setDescription($description);
} else {
$thumbAsset = new thumbAsset();
$thumbAsset->setPartnerId($entry->getPartnerId());
$thumbAsset->setEntryId($entry->getId());
$thumbAsset->setDescription($errDescription);
$thumbAsset->setFlavorParamsId($destThumbParams->getId());
}
$thumbAsset->incrementVersion();
$thumbAsset->setTags($destThumbParamsOutput->getTags());
$thumbAsset->setFileExt($destThumbParamsOutput->getFileExt());
if ($thumbAsset->getStatus() != asset::ASSET_STATUS_READY) {
$thumbAsset->setStatus(asset::ASSET_STATUS_CONVERTING);
}
//Sets the default thumb if this the only default thumb
kBusinessPreConvertDL::setIsDefaultThumb($thumbAsset);
if (!$destThumbParamsOutput) {
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->save();
return null;
}
$thumbAsset->save();
// save flavor params
$destThumbParamsOutput->setPartnerId($entry->getPartnerId());
$destThumbParamsOutput->setEntryId($entry->getId());
$destThumbParamsOutput->setFlavorAssetId($thumbAsset->getId());
$destThumbParamsOutput->setFlavorAssetVersion($thumbAsset->getVersion());
$destThumbParamsOutput->save();
$srcSyncKey = $srcAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
$srcAssetType = $srcAsset->getType();
if (!$runSync) {
$job = kJobsManager::addCapturaThumbJob($parentJob, $entry->getPartnerId(), $entry->getId(), $thumbAsset->getId(), $srcSyncKey, $srcAsset->getId(), $srcAssetType, $destThumbParamsOutput);
return $thumbAsset;
}
$errDescription = null;
// Since this method is called when trying to crop an existing thumbnail, need to add this check - thumbAssets have no mediaInfo.
$capturedPath = self::generateThumbnail($srcAsset, $destThumbParamsOutput, $errDescription, $mediaInfo ? $mediaInfo->getVideoRotation() : null);
// failed
if (!$capturedPath) {
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_ERROR);
$thumbAsset->setDescription($thumbAsset->getDescription() . "\n{$errDescription}");
$thumbAsset->save();
return $thumbAsset;
}
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::ASSET_STATUS_QUEUED);
if (file_exists($capturedPath)) {
list($width, $height, $type, $attr) = getimagesize($capturedPath);
$thumbAsset->setWidth($width);
$thumbAsset->setHeight($height);
$thumbAsset->setSize(filesize($capturedPath));
}
$logPath = $capturedPath . '.log';
if (file_exists($logPath)) {
$thumbAsset->incLogFileVersion();
$thumbAsset->save();
// creats the file sync
$logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
KalturaLog::info("Log archived file to: " . kFileSyncUtils::getLocalFilePathForKey($logSyncKey));
} else {
$thumbAsset->save();
}
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($capturedPath, $syncKey);
KalturaLog::info("Thumbnail archived file to: " . kFileSyncUtils::getLocalFilePathForKey($syncKey));
$thumbAsset->setStatus(thumbAsset::ASSET_STATUS_READY);
$thumbAsset->save();
if ($thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
// increment thumbnail version
$entry->setThumbnail(".jpg");
$entry->setCreateThumb(false);
$entry->save();
$entrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
$syncFile = kFileSyncUtils::createSyncFileLinkForKey($entrySyncKey, $syncKey);
if ($syncFile) {
// removes the DEFAULT_THUMB tag from all other thumb assets
assetPeer::removeThumbAssetDeafultTags($entry->getId(), $thumbAsset->getId());
}
}
if (!is_null($thumbAsset->getFlavorParamsId())) {
kFlowHelper::generateThumbnailsFromFlavor($thumbAsset->getEntryId(), null, $thumbAsset->getFlavorParamsId());
}
return $thumbAsset;
}
示例2: setCreateThumb
public function setCreateThumb($v, thumbAsset $thumbAsset = null)
{
if (!$v) {
assetPeer::removeThumbAssetDeafultTags($this->getId(), $thumbAsset ? $thumbAsset->getId() : null);
}
$this->putInCustomData("createThumb", (bool) $v);
}
示例3: handleCaptureThumbFinished
/**
* @param BatchJob $dbBatchJob
* @param kCaptureThumbJobData $data
* @return BatchJob
*/
public static function handleCaptureThumbFinished(BatchJob $dbBatchJob, kCaptureThumbJobData $data)
{
if ($dbBatchJob->getExecutionStatus() == BatchJobExecutionStatus::ABORTED) {
return $dbBatchJob;
}
// verifies that thumb asset created
if (!$data->getThumbAssetId()) {
throw new APIException(APIErrors::INVALID_THUMB_ASSET_ID, $data->getThumbAssetId());
}
$thumbAsset = assetPeer::retrieveById($data->getThumbAssetId());
// verifies that thumb asset exists
if (!$thumbAsset) {
throw new APIException(APIErrors::INVALID_THUMB_ASSET_ID, $data->getThumbAssetId());
}
$thumbAsset->incrementVersion();
$thumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
if (file_exists($data->getThumbPath())) {
list($width, $height, $type, $attr) = getimagesize($data->getThumbPath());
$thumbAsset->setWidth($width);
$thumbAsset->setHeight($height);
$thumbAsset->setSize(filesize($data->getThumbPath()));
}
$logPath = $data->getThumbPath() . '.log';
if (file_exists($logPath)) {
$thumbAsset->incLogFileVersion();
$thumbAsset->save();
// creats the file sync
$logSyncKey = $thumbAsset->getSyncKey(flavorAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_CONVERT_LOG);
try {
kFileSyncUtils::moveFromFile($logPath, $logSyncKey);
} catch (Exception $e) {
$err = 'Saving conversion log: ' . $e->getMessage();
KalturaLog::err($err);
$desc = $dbBatchJob->getDescription() . "\n" . $err;
$dbBatchJob->getDescription($desc);
}
} else {
$thumbAsset->save();
}
$syncKey = $thumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
kFileSyncUtils::moveFromFile($data->getThumbPath(), $syncKey);
$data->setThumbPath(kFileSyncUtils::getLocalFilePathForKey($syncKey));
KalturaLog::info("Thumbnail archived file to: " . $data->getThumbPath());
// save the data changes to the db
$dbBatchJob->setData($data);
$dbBatchJob->save();
$entry = $thumbAsset->getentry();
if ($entry && $entry->getCreateThumb() && $thumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB)) {
$entry = $dbBatchJob->getEntry(false, false);
if (!$entry) {
throw new APIException(APIErrors::INVALID_ENTRY, $dbBatchJob, $dbBatchJob->getEntryId());
}
// increment thumbnail version
$entry->setThumbnail(".jpg");
$entry->setCreateThumb(false);
$entry->save();
$entrySyncKey = $entry->getSyncKey(entry::FILE_SYNC_ENTRY_SUB_TYPE_THUMB);
$syncFile = kFileSyncUtils::createSyncFileLinkForKey($entrySyncKey, $syncKey);
if ($syncFile) {
// removes the DEFAULT_THUMB tag from all other thumb assets
assetPeer::removeThumbAssetDeafultTags($entry->getId(), $thumbAsset->getId());
}
}
if (!is_null($thumbAsset->getFlavorParamsId())) {
kFlowHelper::generateThumbnailsFromFlavor($dbBatchJob->getEntryId(), $dbBatchJob, $thumbAsset->getFlavorParamsId());
}
self::handleLocalFileSyncDeletion($dbBatchJob->getEntryId(), $dbBatchJob->getPartner());
return $dbBatchJob;
}