public function beforeSave()
 {
     if ($this->parent != '' and $this->parent != 0) {
         $parent = $this->model()->resetScope()->findByPk((int) $this->parent);
         if ($this->slug == '') {
             $this->slug = $parent->slug . '-' . $this->name;
         } else {
             if ($this->isNewRecord) {
                 $this->slug = $parent->slug . '-' . $this->slug;
             } else {
                 $model = $this->model()->resetScope()->findByPk((int) $this->term_id);
                 if ($model->slug != $this->slug) {
                     $this->slug = $parent->slug . '-' . $this->slug;
                 }
             }
         }
     } else {
         if ($this->slug == '') {
             $this->slug = $this->name;
         }
     }
     $this->images = str_replace(Helper::rootImg('content'), '', $this->images);
     $this->taxonomy = $this->_taxonomy;
     $this->name = Ucfirst($this->name);
     return parent::beforeSave();
 }
 public function beforeSave()
 {
     // create thumb with ext easyImage -> check components/helper and extensions/easyimage
     Helper::createThumb(array('thumbDir' => Helper::rootImg('content/.thumb'), 'imageDir' => Helper::rootImg('content'), 'image' => $this->photo, 'small' => array('width' => 100, 'height' => 100, 'type' => EasyImage::RESIZE_HEIGHT), 'medium' => array('width' => 300, 'height' => 150, 'type' => EasyImage::RESIZE_WIDTH), 'large' => array('width' => 600, 'height' => 350, 'type' => EasyImage::RESIZE_WIDTH)));
     $this->photo = str_replace(Helper::rootImg('content'), '', $this->photo);
     return parent::beforeSave();
 }