本文整理汇总了PHP中assetPeer::retrieveReadyThumbnailsByEntryId方法的典型用法代码示例。如果您正苦于以下问题:PHP assetPeer::retrieveReadyThumbnailsByEntryId方法的具体用法?PHP assetPeer::retrieveReadyThumbnailsByEntryId怎么用?PHP assetPeer::retrieveReadyThumbnailsByEntryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类assetPeer
的用法示例。
在下文中一共展示了assetPeer::retrieveReadyThumbnailsByEntryId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateForSubmission
/**
* @param EntryDistribution $entryDistribution
* @param int $action enum from DistributionAction
* @return array<kDistributionValidationError>
*/
public function validateForSubmission(EntryDistribution $entryDistribution, $action)
{
$validationErrors = array();
$distributionProvider = $this->getProvider();
if (!$distributionProvider) {
KalturaLog::err("Entry distribution [" . $entryDistribution->getId() . "] provider [" . $this->getProviderType() . "] not found");
return $validationErrors;
}
if ($action == DistributionAction::UPDATE || $entryDistribution->getStatus() == EntryDistributionStatus::READY || $entryDistribution->getStatus() == EntryDistributionStatus::ERROR_UPDATING) {
if (!$distributionProvider->isUpdateEnabled() || !$distributionProvider->isMediaUpdateEnabled()) {
KalturaLog::log("Entry distribution [" . $entryDistribution->getId() . "] provider [" . $distributionProvider->getName() . "] does not support update");
return $validationErrors;
}
}
$requiredFlavorParamsIds = $this->getRequiredFlavorParamsIdsArray();
KalturaLog::log("Required Flavor Params Ids [" . print_r($requiredFlavorParamsIds, true) . "]");
$entryFlavorAssets = assetPeer::retrieveReadyFlavorsByEntryId($entryDistribution->getEntryId());
$requiredFlavorParamsIdsKeys = array_flip($requiredFlavorParamsIds);
foreach ($entryFlavorAssets as $entryFlavorAsset) {
$flavorParamsId = $entryFlavorAsset->getFlavorParamsId();
if (isset($requiredFlavorParamsIdsKeys[$flavorParamsId])) {
unset($requiredFlavorParamsIds[$requiredFlavorParamsIdsKeys[$flavorParamsId]]);
}
}
foreach ($requiredFlavorParamsIds as $requiredFlavorParamsId) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::MISSING_FLAVOR, $requiredFlavorParamsId);
}
$requiredThumbDimensions = $this->getRequiredThumbDimensionsObjects();
KalturaLog::log("Required Thumb Dimensions [" . print_r($requiredThumbDimensions, true) . "]");
$entryThumbAssets = assetPeer::retrieveReadyThumbnailsByEntryId($entryDistribution->getEntryId());
$requiredThumbDimensionsWithKeys = array();
foreach ($requiredThumbDimensions as $requiredThumbDimension) {
$key = $requiredThumbDimension->getKey();
$requiredThumbDimensionsWithKeys[$key] = $requiredThumbDimension;
}
foreach ($entryThumbAssets as $entryThumbAsset) {
$key = $entryThumbAsset->getWidth() . 'x' . $entryThumbAsset->getHeight();
if (isset($requiredThumbDimensionsWithKeys[$key])) {
unset($requiredThumbDimensionsWithKeys[$key]);
}
}
foreach ($requiredThumbDimensionsWithKeys as $key => $requiredThumbDimension) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::MISSING_THUMBNAIL, $key);
}
$entryAssets = assetPeer::retrieveReadyByEntryId($entryDistribution->getEntryId());
$requiredAssetDistributionRules = $this->getRequiredAssetDistributionRules();
foreach ($requiredAssetDistributionRules as $entryAssetDistributionRule) {
$foundMatchingAsset = false;
/* @var $entryAssetDistributionRule kAssetDistributionRule */
foreach ($entryAssets as $entryAsset) {
/* @var $entryAsset asset */
if ($entryAssetDistributionRule->fulfilled($entryAsset)) {
$foundMatchingAsset = true;
break;
}
}
if (!$foundMatchingAsset) {
$validationErrors[] = $this->createValidationError($action, DistributionErrorType::MISSING_ASSET, $entryAssetDistributionRule->getValidationError());
}
}
return $validationErrors;
}
示例2: assignThumbAssets
/**
* @param EntryDistribution $entryDistribution
* @param entry $entry
* @param DistributionProfile $distributionProfile
* @return boolean true if the list of thumbnails modified
*/
public static function assignThumbAssets(EntryDistribution $entryDistribution, entry $entry, DistributionProfile $distributionProfile)
{
$submittingStatuses = array(EntryDistributionStatus::PENDING, EntryDistributionStatus::QUEUED, EntryDistributionStatus::SUBMITTING, EntryDistributionStatus::IMPORT_SUBMITTING, EntryDistributionStatus::ERROR_SUBMITTING);
// if not in first submmiting status then it's an update and need to check if update is supported.
if (!in_array($entryDistribution->getStatus(), $submittingStatuses)) {
$distributionProvider = $distributionProfile->getProvider();
if (!$distributionProvider) {
KalturaLog::log("Entry distribution [" . $entryDistribution->getId() . "] provider not found");
return false;
}
if (!$distributionProvider->isUpdateEnabled() || !$distributionProvider->isMediaUpdateEnabled()) {
KalturaLog::log("Entry distribution [" . $entryDistribution->getId() . "] provider [" . $distributionProvider->getName() . "] does not support update");
return false;
}
}
$thumbAssetsIds = array();
$thumbDimensions = $distributionProfile->getThumbDimensionsObjects();
$thumbDimensionsWithKeys = array();
foreach ($thumbDimensions as $thumbDimension) {
$thumbDimensionsWithKeys[$thumbDimension->getKey()] = $thumbDimension;
}
$originalList = $entryDistribution->getThumbAssetIds();
// remove deleted thumb assets
$assignedThumbAssetIds = $originalList;
if ($assignedThumbAssetIds) {
$assignedThumbAssets = assetPeer::retrieveByIds(explode(',', $assignedThumbAssetIds));
foreach ($assignedThumbAssets as $assignedThumbAsset) {
$key = $assignedThumbAsset->getWidth() . 'x' . $assignedThumbAsset->getHeight();
if (isset($thumbDimensionsWithKeys[$key])) {
unset($thumbDimensionsWithKeys[$key]);
$thumbAssetsIds[] = $assignedThumbAsset->getId();
}
}
}
// add new thumb assets
$requiredThumbParamsIds = $distributionProfile->getAutoCreateThumbArray();
$thumbAssets = assetPeer::retrieveReadyThumbnailsByEntryId($entry->getId());
foreach ($thumbAssets as $thumbAsset) {
if (in_array($thumbAsset->getFlavorParamsId(), $requiredThumbParamsIds)) {
$thumbAssetsIds[] = $thumbAsset->getId();
KalturaLog::log("Assign thumb asset [" . $thumbAsset->getId() . "] from required thumbnail params ids");
continue;
}
$key = $thumbAsset->getWidth() . 'x' . $thumbAsset->getHeight();
if (isset($thumbDimensionsWithKeys[$key])) {
unset($thumbDimensionsWithKeys[$key]);
KalturaLog::log("Assign thumb asset [" . $thumbAsset->getId() . "] from dimension [{$key}]");
$thumbAssetsIds[] = $thumbAsset->getId();
}
}
$entryDistribution->setThumbAssetIds($thumbAssetsIds);
return $originalList != $entryDistribution->getThumbAssetIds();
}
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:59,代码来源:kContentDistributionManager.php
示例3: getNearestAspectRatioThumbnailDescriptorByEntryId
/**
* Go over all thumbnails (with status = ASSET_STATUS_READY) and look for an exact match.
* If none is found, look for the one with the nearest aspect ratio.
* This would be the one with the smallest distance from the original.
*
* @param string $entryId Id of entry containing the thumbnails
* @param int $requiredWidth Thumbnail's requested width
* @param int $requiredHeight Thumbnail's requested height
* @return string|null The path to the physical thumbnail file
*/
public static function getNearestAspectRatioThumbnailDescriptorByEntryId($entryId, $requiredWidth, $requiredHeight, $fallbackThumbnailPath)
{
$thumbAssets = assetPeer::retrieveReadyThumbnailsByEntryId($entryId);
return self::getNearestAspectRatioThumbnailDescriptorFromThumbAssets($thumbAssets, $requiredWidth, $requiredHeight, $fallbackThumbnailPath);
}