简体   繁体   中英

broken image using Laravel 5 /Voyager

Currently, the Laravel app is saving correctly on MyProject/public/storage but the image on the app is always broken. If I save the images on MyProject/storage/ directory it works, I think there is a config I need to update.

If I update APP_URL and use php artisan serve, there are no issues. But when I try to deploy it on xampp, the issue occurs.

please help

here is the directory details:

xampp/
├── htdocs/ (public folder)
│   ├── MyProject/ 
│       ├── storage/
│       ├── .htaccess
├── MyprojectCore/
│   ├── public/
|       ├── storage/ 
│       

filesystem.php

'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'),
            'url' => env('AWS_URL'),
        ],

    ]

voyager.php

'storage' => [
        'disk' => 'public',
    ],

.env

APP_URL=http://localhost:8080/MyProject

index.php

require __DIR__.'/../../ECRCore/vendor/autoload.php';
$app = require_once __DIR__.'/../../ECRCore/bootstrap/app.php';

This sounds like an incorrect APP_URL setting. Are you sure that the address is completely identical when using XAMPP and artisan serve?

I've also seen images disappear because one address was in HTTP and the other HTTPS. So keep this in mind.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM