/** * 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(); }
/** * Update folder details (use if name is changed) * * @returns $this * @throws FileManagerException */ public function updateDetails() { $this->folder->dir = $this->url->pathToUrl($this->getPath()->relativePath()); $this->folder->url = $this->url->forFolder($this->getPath(), $this->name()); $this->folder->updated_at = date('Y-m-d H:i:s', stat($this->fullPath())['mtime']); $this->folder->bytes = FileSystem::dirSize($this->fullPath(), [$this->getPath()->thumbDirName()]); return $this; }
/** * Update file url * @throws FileManagerException */ private function updateUrl() { $this->file->url = $this->url->forName($this->getPath(), $this->fullName()); }