Example #1
0
 /**
  * Determine if routes already exists.
  *
  * @return boolean
  */
 protected function alreadyExists()
 {
     $path = $this->getPath();
     if (!$this->is52or51() && $this->files->exists($path)) {
         return $this->files->size($path) !== 504;
     }
     return $this->files->exists($path);
 }
Example #2
0
 /**
  * Attach files to be uploaded.
  *
  * @param array $files
  *
  * @return \Dingo\Api\Dispatcher
  */
 public function attach(array $files)
 {
     foreach ($files as $key => $file) {
         if (is_array($file)) {
             $file = new UploadedFile($file['path'], basename($file['path']), $file['mime'], $file['size']);
         } elseif (is_string($file)) {
             $finfo = finfo_open(FILEINFO_MIME_TYPE);
             $file = new UploadedFile($file, basename($file), finfo_file($finfo, $file), $this->files->size($file));
         } elseif (!$file instanceof UploadedFile) {
             continue;
         }
         $this->uploads[$key] = $file;
     }
     return $this;
 }
Example #3
0
 /**
  * Get the file size of a given file.
  *
  * @param string $path
  * @return int 
  * @static 
  */
 public static function size($path)
 {
     return \Illuminate\Filesystem\Filesystem::size($path);
 }
 /**
  * @param $path
  * @return int
  */
 public function size($path)
 {
     return $this->storage->size($this->storagePath($path));
 }
Example #5
0
 private function sendImage($path)
 {
     $image = $this->files->get($path);
     return response()->make($image, 200, ['Content-Type' => 'image/png', 'Cache-Control' => 'public, max-age=157788000', 'Content-Length' => $this->files->size($path), 'Last-Modified' => 'Tue, 11 Jan 2000 00:57:26 GMT', 'Expires' => date(DATE_RFC822, strtotime("720 day")), 'Vary' => 'Accept-Encoding']);
 }
 /**
  * Get the size of the file located at the given path.
  *
  * @param string $path
  *
  * @return mixed
  */
 protected function getFileSize($path)
 {
     return $this->filesystem->size($path);
 }