public static function getByName($name)
{
$cacheKey = "imagethumb_" . crc32($name);
try {
$thumbnail = \Zend_Registry::get($cacheKey);
$thumbnail->setName($name);
if (!$thumbnail) {
throw new \Exception("Thumbnail in registry is null");
}
} catch (\Exception $e) {
try {
$thumbnail = new self();
$thumbnail->setName($name);
$thumbnail->getDao()->getByName();
\Zend_Registry::set($cacheKey, $thumbnail);
} catch (\Exception $e) {
return null;
}
}
// 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 $thumbnail;
return $clone;
}