Example #1
0
 protected function afterFind()
 {
     if ($this->name && $this->fullPath) {
         $this->fullPath = rtrim($this->fullPath, " /");
         list($baseName, $ext) = explode(".", $this->name);
         $template = $this->fullPath . "/" . $baseName;
         foreach ($this->imageSizes as $key => $value) {
             if (!empty($key)) {
                 $sizeVar = $key . "Name";
                 $suffix = $key . "Suffix";
                 if (!isset($this->{$sizeVar})) {
                     throw new RuntimeException('Cannot set name variable for class ' . get_class($this) . '[name : ' . $key . ']');
                 }
                 if (!isset($this->{$suffix})) {
                     throw new RuntimeException('Suffix var does not exist ' . get_class($this) . ' [suffix name : ' . $key . ']');
                 }
                 $this->{$sizeVar} = basename($template . $this->{$suffix} . "." . $ext);
             }
         }
     }
     parent::afterFind();
 }