/** * @param string $config * @return Asset_Video_Thumbnail|null */ public function getThumbnailConfig($config) { $thumbnail = null; if (is_string($config)) { try { $thumbnail = Asset_Video_Thumbnail_Config::getByName($config); } catch (Exception $e) { Logger::error("requested video-thumbnail " . $config . " is not defined"); return null; } } else { if ($config instanceof Asset_Video_Thumbnail_Config) { $thumbnail = $config; } } return $thumbnail; }
public function videoThumbnailUpdateAction() { $pipe = Asset_Video_Thumbnail_Config::getByName($this->_getParam("name")); $data = Zend_Json::decode($this->_getParam("configuration")); $items = array(); foreach ($data as $key => $value) { $setter = "set" . ucfirst($key); if (method_exists($pipe, $setter)) { $pipe->{$setter}($value); } if (strpos($key, "item.") === 0) { $cleanKeyParts = explode(".", $key); $items[$cleanKeyParts[1]][$cleanKeyParts[2]] = $value; } } $pipe->resetItems(); foreach ($items as $item) { $type = $item["type"]; unset($item["type"]); $pipe->addItem($type, $item); } $pipe->save(); $this->deleteVideoThumbnailTmpFiles($pipe); $this->_helper->json(array("success" => true)); }