コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function postUpdate(MediaInterface $media)
 {
     if (!$media->getBinaryContent() instanceof \SplFileInfo) {
         return;
     }
     // Delete the current file from the FS
     $oldMedia = clone $media;
     // if no previous reference is provided, it prevents
     // Filesystem from trying to remove a directory
     if ($media->getPreviousProviderReference() !== null) {
         $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);
     $media->resetBinaryContent();
 }
コード例 #2
0
ファイル: FileProvider.php プロジェクト: ingeniorweb/symfo3cv
 /**
  * {@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);
 }