예제 #1
0
 /**
  * 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();
 }
예제 #2
0
 /**
  * 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;
 }
예제 #3
0
 /**
  * Update file url
  * @throws FileManagerException
  */
 private function updateUrl()
 {
     $this->file->url = $this->url->forName($this->getPath(), $this->fullName());
 }