/**
  * @param File $file
  *
  * @return bool
  *
  * @throws FileManagerException
  */
 public function deleteFile(File $file)
 {
     $path = $file->fullPath();
     if (!FileSystem::exists($path)) {
         throw new FileManagerException($this, 'err_file_not_found');
     }
     if (!Perms::canDelete($path)) {
         throw new FileManagerException($this, 'err_file_delete_perm');
     }
     if (FileSystem::delete($path)) {
         if ($file->isImage()) {
             $this->thumb->delete($file);
         }
         return true;
     }
     return false;
 }
示例#2
0
 /**
  * Delete file thumbs from filesystem
  *
  * @param File $file
  * @throws \Crip\FileManager\Exceptions\FileManagerException
  */
 public function delete(File $file)
 {
     collect(array_keys($this->sizes))->each(function ($size) use($file) {
         $path = $file->getPath()->thumbPath($size, $file);
         if (FileSystem::exists($path)) {
             FileSystem::delete($path);
         }
     });
 }