【发布时间】:2018-06-22 13:21:08
【问题描述】:
我使用 GODADDY 作为我的主机,现在我部署我的项目一切正常,但除了这个图像,我如何显示使用图像 干预包保存到我的 sql 数据库中的图像在 Laravel 中,我在保存图像时没有问题,唯一的问题是如何在我的视图中显示它。我的控制器会将它保存在 public/uploads
详细信息: $leads=型号, 上传*=文件夹,图片=数据库列*
注意:我已经尝试了以下 html 代码,但仍然无法正常工作 除了 uploads 文件夹
,我所有公开的项目都已移至 public_html<img src="{{ asset($leads->image) }}" />--this is not working
<img src="{{ asset('uploads/' . leads->image) }}" />--this is not working
<img src="{{ asset('uploads')}}/{{ $leads->image) }}" />--this is not working
<img src="{{ URL::asset('storage/uploads'.$leads->image) }}">
<img src="/uploads/{{$leads->image}}" >--only works in my local computer
文件系统
<?php
返回 [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "s3", "rackspace"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
],
],
];
谁能指出我正确的方向/或教程..
【问题讨论】:
-
您可以检查那些不工作的脚本显示的路径,然后从那里开始工作。对损坏的图像执行检查元素并查看它们作为路径的内容。
-
你可以将你的虚拟主机指向 laravel
public文件夹而不是默认的public_html -
@rkj 我如何指向我的公众?
-
你可以访问你服务器的 apache 吗?
-
@hungrykoala yow 感谢inspect element 回答我的问题哈哈我错过了一些/沿着代码谢谢伙计..