public static function fromDbArray($arr)
 {
     $newArr = new KalturaThumbAssetArray();
     if ($arr == null) {
         return $newArr;
     }
     foreach ($arr as $obj) {
         $nObj = new KalturaThumbAsset();
         $nObj->fromObject($obj);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
Esempio n. 2
0
 public static function fromDbArray($arr, KalturaDetachedResponseProfile $responseProfile = null)
 {
     $newArr = new KalturaThumbAssetArray();
     if ($arr == null) {
         return $newArr;
     }
     foreach ($arr as $obj) {
         $nObj = KalturaThumbAsset::getInstance($obj, $responseProfile);
         $newArr[] = $nObj;
     }
     return $newArr;
 }
 function update($id, KalturaThumbAsset $thumbAsset, KalturaContentResource $contentResource = null)
 {
     $kparams = array();
     $this->client->addParam($kparams, "id", $id);
     $this->client->addParam($kparams, "thumbAsset", $thumbAsset->toParams());
     if ($contentResource !== null) {
         $this->client->addParam($kparams, "contentResource", $contentResource->toParams());
     }
     $this->client->queueServiceActionCall("thumbasset", "update", $kparams);
     if ($this->client->isMultiRequest()) {
         return null;
     }
     $resultObject = $this->client->doQueue();
     $this->client->throwExceptionIfError($resultObject);
     $this->client->validateObjectType($resultObject, "KalturaThumbAsset");
     return $resultObject;
 }
Esempio n. 4
0
 public function validateForInsert($propertiesToSkip = array())
 {
     $this->validateCuePointAssociation();
     parent::validateForInsert($propertiesToSkip);
 }
 /**
  * @action addFromImage
  * @param string $entryId
  * @param file $fileData
  * @return KalturaThumbAsset
  * 
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  * @validateUser entry entryId edit
  */
 public function addFromImageAction($entryId, $fileData)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $ext = pathinfo($fileData["name"], PATHINFO_EXTENSION);
     $dbThumbAsset = new thumbAsset();
     $dbThumbAsset->setPartnerId($dbEntry->getPartnerId());
     $dbThumbAsset->setEntryId($dbEntry->getId());
     $dbThumbAsset->setStatus(thumbAsset::ASSET_STATUS_QUEUED);
     $dbThumbAsset->setFileExt($ext);
     $dbThumbAsset->incrementVersion();
     $dbThumbAsset->save();
     $syncKey = $dbThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($fileData["tmp_name"], $syncKey);
     $finalPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     list($width, $height, $type, $attr) = getimagesize($finalPath);
     $dbThumbAsset->setWidth($width);
     $dbThumbAsset->setHeight($height);
     $dbThumbAsset->setSize(filesize($finalPath));
     $dbThumbAsset->setStatus(thumbAsset::ASSET_STATUS_READY);
     $dbThumbAsset->save();
     $dbEntryThumbs = assetPeer::retrieveThumbnailsByEntryId($entryId);
     //If the thums has the default tag or the entry is in no content and this is the first thumb
     if ($dbEntry->getCreateThumb() && ($dbThumbAsset->hasTag(thumbParams::TAG_DEFAULT_THUMB) || $dbEntry->getStatus() == KalturaEntryStatus::NO_CONTENT && count($dbEntryThumbs) == 1)) {
         $this->setAsDefaultAction($dbThumbAsset->getId());
     }
     $thumbAssets = new KalturaThumbAsset();
     $thumbAssets->fromObject($dbThumbAsset);
     return $thumbAssets;
 }
Esempio n. 6
0
 /**
  * @action addFromImage
  * @param string $entryId
  * @param file $fileData
  * @return KalturaThumbAsset
  * 
  * @throws KalturaErrors::ENTRY_ID_NOT_FOUND
  */
 public function addFromImageAction($entryId, $fileData)
 {
     $dbEntry = entryPeer::retrieveByPK($entryId);
     if (!$dbEntry) {
         throw new KalturaAPIException(KalturaErrors::ENTRY_ID_NOT_FOUND, $entryId);
     }
     $ext = pathinfo($fileData["name"], PATHINFO_EXTENSION);
     $dbThumbAsset = new thumbAsset();
     $dbThumbAsset->setPartnerId($dbEntry->getPartnerId());
     $dbThumbAsset->setEntryId($dbEntry->getId());
     $dbThumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_QUEUED);
     $dbThumbAsset->setFileExt($ext);
     $dbThumbAsset->incrementVersion();
     $dbThumbAsset->save();
     $syncKey = $dbThumbAsset->getSyncKey(thumbAsset::FILE_SYNC_FLAVOR_ASSET_SUB_TYPE_ASSET);
     kFileSyncUtils::moveFromFile($fileData["tmp_name"], $syncKey);
     $finalPath = kFileSyncUtils::getLocalFilePathForKey($syncKey);
     list($width, $height, $type, $attr) = getimagesize($finalPath);
     $dbThumbAsset->setWidth($width);
     $dbThumbAsset->setHeight($height);
     $dbThumbAsset->setSize(filesize($finalPath));
     $dbThumbAsset->setStatus(thumbAsset::FLAVOR_ASSET_STATUS_READY);
     $dbThumbAsset->save();
     $thumbAssets = new KalturaThumbAsset();
     $thumbAssets->fromObject($dbThumbAsset);
     return $thumbAssets;
 }