使用cpanel

时间:2018-06-22 04:47:06

标签: php html laravel

我正在使用 GODADDY 作为主机,现在我部署了项目,一切正常,但是除了该映像外,我如何显示使用映像 intervention包保存到我的sql数据库中的映像在Laravel 中,我在保存图像时没有问题,唯一的问题是如何在View中显示它。我的控制器会将其保存在 public / uploads < / p>

详细信息: $ 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'),
    ],

],

];

任何人都可以向我指出正确的方向/或教程。

1 个答案:

答案 0 :(得分:0)

是的,我找到了答案,但我错过了一些内容。

最终密码:

{{ URL::asset('public/uploads/'.$leads->image)}}