/** * Get all thumb details * * @param File $file * @return array * @throws \Crip\FileManager\Exceptions\FileManagerException */ public function details(File $file) { $thumbs = collect([]); if ($file->isImage()) { collect(array_keys($this->sizes))->each(function ($size) use($thumbs, $file) { list($width, $height) = getimagesize($this->getPath()->thumbPath($size, $file)); $thumbs->put($size, ['url' => $this->url->forName($this->getPath(), $file->fullName(), $size), 'size' => [$width, $height]]); }); } return $thumbs->all(); }
/** * @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; }