Example #1
0
 /**
  * {@inheritdoc}
  */
 public function postUpdate(MediaInterface $media)
 {
     if (!$media->getBinaryContent() instanceof \SplFileInfo) {
         return;
     }
     // Delete the current file from the FS
     $oldMedia = clone $media;
     $oldMedia->setProviderReference($media->getPreviousProviderReference());
     $path = $this->getReferenceImage($oldMedia);
     if ($this->getFilesystem()->has($path)) {
         $this->getFilesystem()->delete($path);
     }
     $this->fixBinaryContent($media);
     $this->setFileContents($media);
     $this->generateThumbnails($media);
 }