/** * @ORM\PostPersist() * @ORM\PostUpdate() */ public function saveFile(Photo $photo, LifecycleEventArgs $event) { if (null === $photo->getFile()) { return; } $photo->getFile()->move($this->uploadRootDir, $photo->getFilename()); $resizer = new ImagickPhotoResizer($this->uploadRootDir . $photo->getFilename()); $resizer->resize($this->uploadRootDir . $photo->getResizedFilename(), 1000, 700); $resizer->resizeToSquare($this->uploadRootDir . $photo->getThumbFilename(), 300); $photo->setFile(null); }