当前位置: 首页>>代码示例>>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;未经允许,请勿转载。