/** * @inheritdoc */ public function afterSave() { parent::afterSave(); if ($this->crop_changed) { $this->createCrop(); } }
/** * @inheritdoc */ public function afterSave() { parent::afterSave(); if (in_array($this->owner->scenario, $this->scenarios)) { $image = null; foreach ($this->getConfigurations() as $crop) { if (isset($crop['_changed']) && $crop['_changed']) { if (!$image) { $path = $this->getUploadPath($this->attribute); if (!$path) { $path = $this->getUploadPath($this->attribute, true); } $image = Image::getImagine()->open($path); } $this->createCrop($crop, $image->copy()); } } } }