當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Storage::size方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Storage::size方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::size方法的具體用法?PHP Storage::size怎麽用?PHP Storage::size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Storage的用法示例。


在下文中一共展示了Storage::size方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: write

 /**
  * Write a new file.
  *
  * @param string $path
  * @param string $localPath
  * @param Config $config   Config object
  *
  * @return array|false false on failure file meta data on success
  */
 public function write($path, $localPath, Config $config)
 {
     $object = $this->bucket->object($path);
     $params = [];
     $size = Storage::size($localPath);
     if ($this->isSizeBiggerForMultiPart($size)) {
         $params['multipart'] = true;
     }
     $object->write($localPath, $params);
 }
開發者ID:fileio,項目名稱:dag-client,代碼行數:19,代碼來源:DagAdapter.php

示例2: zipAll

 public function zipAll()
 {
     $files = TFFile::where('state', '=', 'downloaded')->get();
     $imageCount = TFFile::where('state', '=', 'downloaded')->where('type', '=', 'image')->count();
     $videoCount = TFFile::where('state', '=', 'downloaded')->where('type', '=', 'video')->count();
     if ($videoCount == 0 && $imageCount == 0) {
         Log::info('TFZipper : no file to be zipped.');
         return;
     }
     $fileLocs = "";
     $deleteLocs = [];
     foreach ($files as $file) {
         $deleteLocs[] = $file->location;
         $fileLocs .= ' ' . storage_path('app/' . $file->location);
         $file->state = 'zipped';
         $file->save();
     }
     $zipName = Carbon::now()->toDateString() . '.zip';
     $zipLocs = 'zip/' . $zipName;
     $cmdPass = self::PASSWORD;
     $cmdTarget = storage_path('app/' . $zipLocs);
     $cmdLocs = $fileLocs;
     $cmd = "";
     $sys = php_uname('s');
     if ($sys == 'Windows NT') {
         $cmd = $this->rarCmd;
     } else {
         if ($sys == 'Linux') {
             $cmd = $this->zipCmd;
         }
     }
     $cmd = sprintf($cmd, $cmdPass, $cmdTarget, $cmdLocs);
     if ($sys == 'Windows NT') {
         $cmd = str_replace("/", "\\", $cmd);
     }
     $result = $this->runCmd($cmd);
     if (false == $result) {
         return;
     }
     $zip = new TFZip();
     $zip->state = 'zipped';
     $zip->error = '';
     $zip->name = $zipName;
     $zip->date = Carbon::now()->toDateString();
     $zip->size = number_format(Storage::size($zipLocs) / 1024.0 / 1024.0, 2) . 'MB';
     $zip->imageSize = $imageCount;
     $zip->videoSize = $videoCount;
     $zip->location = $zipLocs;
     $zip->save();
     Storage::delete($deleteLocs);
 }
開發者ID:roslairy,項目名稱:tumfetch,代碼行數:51,代碼來源:TFZipper.php

示例3: zipOneDay

 public static function zipOneDay(Carbon $date)
 {
     $begin = $date->copy()->setTime(0, 0, 0);
     $end = $date->copy()->setTime(23, 59, 59);
     $deleteLocs = [];
     $videoLocs = [];
     $videos = Video::where('state', '=', 'downloaded')->where('updated_at', '>=', $begin->toDateTimeString())->where('updated_at', '<=', $end->toDateTimeString())->get();
     foreach ($videos as $video) {
         $deleteLocs[] = $video->location;
         $videoLocs[] = storage_path('app/' . $video->location);
         $video->state = 'zipped';
         $video->save();
     }
     $imageLocs = [];
     $images = Image::where('state', '=', 'downloaded')->where('updated_at', '>=', $begin->toDateTimeString())->where('updated_at', '<=', $end->toDateTimeString())->get();
     foreach ($images as $image) {
         $deleteLocs[] = $image->location;
         $imageLocs[] = storage_path('app/' . $image->location);
         $image->state = 'zipped';
         $image->save();
     }
     $locs = array_merge($videoLocs, $imageLocs);
     if (count($locs) == 0) {
         Log::info('TumblrZip : no file to be ziped.');
         return;
     }
     $zipName = $begin->toDateString() . '.zip';
     $zipLocs = 'zips/' . $zipName;
     $zippy = Zippy::load();
     $zippy->create(storage_path('app/' . $zipLocs), $locs);
     $zip = new Zip();
     $zip->state = 'ziped';
     $zip->error = '';
     $zip->name = $zipName;
     $zip->date = $begin->toDateString();
     $zip->size = number_format(Storage::size($zipLocs) / 1024.0 / 1024.0, 2) . 'MB';
     $zip->imageSize = count($imageLocs);
     $zip->videoSize = count($videoLocs);
     $zip->location = $zipLocs;
     $zip->save();
     Storage::delete($deleteLocs);
 }
開發者ID:roslairy,項目名稱:tumfetch,代碼行數:42,代碼來源:TumblrZip.php

示例4: download

 /**
  * Download action
  *
  * @return mixed
  */
 public function download()
 {
     $filename = config('data.filename');
     return response(Storage::get($filename))->header('Content-Type', 'application/pdf')->header('Content-Length', Storage::size($filename));
 }
開發者ID:r8,項目名稱:cv.r8.com.ua,代碼行數:10,代碼來源:Controller.php

示例5: getSize

 public function getSize()
 {
     return $this->formatSize(Storage::size($this->code));
 }
開發者ID:patrick-mota,項目名稱:hoard-open,代碼行數:4,代碼來源:Snippet.php


注:本文中的Illuminate\Support\Facades\Storage::size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。