2016-09-29 56 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':没有这样的文件或目录 –