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


PHP Storage::mimeType方法代碼示例

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


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

示例1: storeFromUrl

 public function storeFromUrl($url, $path, $name)
 {
     $counter = 1;
     if (Storage::exists($path . '/' . $name . '.' . pathinfo($url, PATHINFO_EXTENSION))) {
         while (Storage::exists($path . '/' . $name . '-' . $counter . '.' . pathinfo($url, PATHINFO_EXTENSION))) {
             $counter++;
         }
         $name = $name . '-' . $counter;
     }
     $file = file_get_contents($url);
     if (Storage::put($path . '/' . $name . '.' . pathinfo($url, PATHINFO_EXTENSION), $file)) {
         $this->filename = $path . '/' . $name . '.' . pathinfo($url, PATHINFO_EXTENSION);
         $this->mime = Storage::mimeType($path . '/' . $name . '.' . pathinfo($url, PATHINFO_EXTENSION));
         $this->original_filename = $url;
         $this->save();
         return $this->id;
     } else {
         return false;
     }
 }
開發者ID:mg9,項目名稱:koalaBazaar,代碼行數:20,代碼來源:FileEntry.php

示例2: fileDetails

 /**
  * Return an array of file details for a file
  */
 protected function fileDetails($path)
 {
     $path = '/' . ltrim($path, '/');
     return ['name' => basename($path), 'fullPath' => $path, 'webPath' => $this->fileWebpath($path), 'mimeType' => Storage::mimeType($path), 'size' => $this->fileSize($path), 'modified' => $this->fileModified($path)];
 }
開發者ID:viktar-pryshchepa,項目名稱:sandbox,代碼行數:8,代碼來源:UploadsManager.php

示例3: viewFile

 public function viewFile($name)
 {
     return response()->make(Storage::get($name), 200, ['Content-Type' => Storage::mimeType($name), 'Content-Disposition' => 'inline; ' . $name]);
 }
開發者ID:bagaswidodo,項目名稱:angular-app,代碼行數:4,代碼來源:FileController.php

示例4: getImage

 public function getImage(Request $request, $image_hash)
 {
     $file = Storage::get('images/' . $image_hash);
     $mimeType = Storage::mimeType('images/' . $image_hash);
     $response = \Illuminate\Support\Facades\Response::make($file, 200);
     $response->header("Content-Type", $mimeType);
     return $response;
 }
開發者ID:VOID001,項目名稱:NEUP-channel,代碼行數:8,代碼來源:ContentController.php


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