【问题标题】:Unisharp Laravel File Manager where /public is \public_htmlUnisharp Laravel 文件管理器,其中 /public 是 \public_html
【发布时间】:2021-12-18 16:04:21
【问题描述】:

我正在使用 Laravel 8。我的网站的公共目录是 public_html,我已经对 appservice 提供者进行了适当的更改:

 public function register()
{
     $this->app->bind('path.public', function() {
            return base_path().'/public_html';
     });
}

并将 lfm is config 更改为

'base_directory' => 'public_html',

文件管理器正在上传到正确的目录并在子目录中正确制作缩略图,但它的视图是一个损坏的符号。

感谢您的帮助。

【问题讨论】:

  • 您在进行更改后是否重新运行php artisan storage:link?并更改了文件系统配置文件中的 SymLink 路径? laravel.com/docs/8.x/filesystem#the-public-disk
  • 我已将文件系统更改为'public' => [ 'driver' => 'local', 'root' => storage_path('app/public_html'), 'url' => env('APP_URL').'/public_html', 'visibility' => 'public', ], ,但URL 仍为<link rel="shortcut icon" type="image/png" href="https://quislingmovie.com/vendor/laravel-filemanager/img/folder.png"> 存储链接已运行。
  • 你能显示你用来显示图像的代码吗?
  • 被CKEditor调用

标签: laravel unisharp-file-manager


【解决方案1】:

您必须将新的存储路径绑定到应用实例。请试试这个:

AppServiceProvider

public function register()
{
    $this->app->instance('path.storage', base_path() . '/public_html');
}

【讨论】:

  • 我已经有了这样的绑定:$this->app->bind('path.public', function() { return base_path().'/public_html'; });跨度>
  • @Jim 他们不同。请看一看。您可以更换它们并尝试一下。
  • 它没有任何区别。它给出的路线为quislingmovie.com/laravel-filemanager/photos/shares/…
【解决方案2】:

只需去掉 src URLs 中的 /laravel-filemanager/ 前缀即可。 你有 photos 作为路线。 示例:

https://quislingmovie.com/photos/shares/6183cadfd8b51.jpg

【讨论】:

  • @Jim 我不明白“修正案停止了整个网站的工作!” .您是在说“替换网址”还是其他修正案?
  • 我已经访问了您的网站,但没有发现任何问题。实际上,答案中的一张图片来自您的网站
  • 问题是文件管理器没有正确显示项目。图片没问题,因为我删除了 URL 的多余部分。
  • @Jim 所以问题的问题(未显示图片)已通过正确的网址解决。
  • "问题是文件管理器没有正确显示项目。"我猜是另一个问题。
猜你喜欢
  • 1970-01-01
  • 2017-01-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-04
  • 2017-06-25
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多