/**
  * @param $name
  * @return Config
  * @throws \Exception
  */
 public static function getByName($name)
 {
     $pipe = new self();
     $pipe->setName($name);
     if (!is_readable($pipe->getConfigFile()) || !$pipe->load()) {
         throw new \Exception("video thumbnail definition : " . $name . " does not exist");
     }
     return $pipe;
 }
Example #2
0
 /**
  * @static
  * @param  $name
  * @return self
  */
 public static function getByName($name)
 {
     $cacheKey = "imagethumb_" . crc32($name);
     if (\Zend_Registry::isRegistered($cacheKey)) {
         $pipe = \Zend_Registry::get($cacheKey);
         $pipe->setName($name);
         // set the name again because in documents there's an automated prefixing logic
     } else {
         $pipe = new self();
         $pipe->setName($name);
         if (!is_readable($pipe->getConfigFile()) || !$pipe->load()) {
             throw new \Exception("thumbnail definition : " . $name . " does not exist");
         }
         \Zend_Registry::set($cacheKey, $pipe);
     }
     // only return clones of configs, this is necessary since we cache the configs in the registry (see above)
     // sometimes, e.g. when using the cropping tools, the thumbnail configuration is modified on-the-fly, since
     // pass-by-reference this modifications would then go to the cache/registry (singleton), by cloning the config
     // we can bypass this problem in an elegant way without parsing the XML config again and again
     $clone = clone $pipe;
     return $clone;
 }