2016-09-29 52 views
1

我正在使用laravel圖像干預。我在/storage/app/public/images的路徑中存儲了一些文件存儲在我的存儲文件夾中。當我嘗試生成路徑通過爲存儲文件顯示的錯誤路徑

$path=Storage::disk('local')->url('screenshot1.jpg'); 

,做DD($ PATH)的文件,它給我的路一樣,

「/storage/screenshot1.jpg」

我想一個路徑,

「/storage/app/public/images/screenshot1.jpg」

我也改變了我的filesystem.php一些變化序,以獲得所需的路徑,

'disks' => [ 

    'local' => [ 
     'driver' => 'local', 
     'root' => storage_path('app/public/images'), 
    ], 

    'public' => [ 
     'driver' => 'local', 
     'root' => storage_path('app/public/images'), 
     'visibility' => 'public', 
    ], 

    's3' => [ 
     'driver' => 's3', 
     'key' => 'your-key', 
     'secret' => 'your-secret', 
     'region' => 'your-region', 
     'bucket' => 'your-bucket', 
    ], 

], 

,但仍然無法正常工作..

回答

0

返回正確的路徑,但,但要獲得在你的路徑,你需要將其從存儲複製到publick文件夾中的URL的內容,OT你應該返回的hwerise作爲base64給客戶端。因爲存儲不能直接從公衆獲得。

您需要與存儲/程序/公/圖像 符號鏈接,如果該文件夾影像時,不會在公共創建然後創建它,你做的符號鏈接之前

ln -s storage/app/public/images public/images 
+0

我有存儲在公共文件夾中這些圖像但它仍然返回相同的路徑,我必須對這個filesystem.php文件進行更改 –

+0

做存儲/應用程序/公共/圖像的公共/圖像符號鏈接 –

+0

這是我的gitbash返回, $ ln -s存儲/ app/public/images public/images ln:未能創建符號鏈接'public/images':沒有這樣的文件或目錄 –