Voyager: Images, media Issu

Created on 7 May 2018  路  8Comments  路  Source: the-control-group/voyager

  • Laravel Version: 5.4.
  • Voyager Version: ^1.1
  • PHP Version: 5.6
  • Database Driver & Version:
    MySql

    Description:

After launching the app from local to the server all images are not visible. The url of the image is
src="http://mysite.com/storage/users/May2018/Tq4bqKXAHMVGtMt6WNWV.jpg". In my root directory which is /public I do have the /storage directory but it has only .gitignore file. I've tried APP_URL=http://127.0.0.1:8000 Doesn't help
APP_URL=http://ubb.st.php-academy.org Doesn't help
Please help! Thank you!
voyager_image_issue

Steps To Reproduce:

Most helpful comment

Your APP_URL needs to change to the domain (use the commented-out one in your screenshot). While we're on the topic, .env does NOT use HTML-style comments, so please get rid of that.

By default, Voyager uses Laravel's default public filesystem (config/filesystems.php). This can be changed, but you might as well understand how it works first.

In short, Laravel will generate links to files at the path of /storage/path/to/file.ext. Through your web browser's configuration, this will equate to the file at /path/to/laravel/public/storage/path/to/file.ext, where storage is a symlink to /path/to/laravel/storage/app/public. Please make sure this is the case (if it's not, your Voyager dashboard will have a banner informing you of this.

Laravel knows how to generate links like this because of the "disk" configuration in config/filesystems.php (ref). This config has a root key which says where to write files to, and a url key which says how to generate URLs.

You're free to change this configuration however you'd like, but check the Laravel docs since Voyager doesn't do anything specific in this regard.

All 8 comments

APP_URL needs to be the URL to your site, including port. Also, your site can't live in a subdirectory (e.g. http://domain.com/path/to/laravel) What's the URL to your site?

The Url to my site is http://ubb.st.php-academy.org. I've tried http://ubb.st.php-academy.org:8000 also.

I've found out where the files that I have uploaded had been stored. It is storage/app/public/
files_being_saved_here

Your APP_URL needs to change to the domain (use the commented-out one in your screenshot). While we're on the topic, .env does NOT use HTML-style comments, so please get rid of that.

By default, Voyager uses Laravel's default public filesystem (config/filesystems.php). This can be changed, but you might as well understand how it works first.

In short, Laravel will generate links to files at the path of /storage/path/to/file.ext. Through your web browser's configuration, this will equate to the file at /path/to/laravel/public/storage/path/to/file.ext, where storage is a symlink to /path/to/laravel/storage/app/public. Please make sure this is the case (if it's not, your Voyager dashboard will have a banner informing you of this.

Laravel knows how to generate links like this because of the "disk" configuration in config/filesystems.php (ref). This config has a root key which says where to write files to, and a url key which says how to generate URLs.

You're free to change this configuration however you'd like, but check the Laravel docs since Voyager doesn't do anything specific in this regard.

Thank you for your help! This is what I have in filesystems.php
filesystems . But I didn't get the point what needs to be changed in order to make the
the links to the images work. The URL that is generated for the user avatar is http://ubb.st.php-academy.org/storage/users/May2018/ZYnEvsUSwt3WLEfmkMJ6.jpg.
voyager_avatar . I still don't have an idea what am I doing wrong. I appreciate your help!

Looks like I finally found the way to make it work. In the filesystems.php

image
Thanks for all your help and prompt responses! Voyager is a cool product!!!

Laravel Version: 5.4.
Voyager Version: ^1.1
PHP Version: 5.6
Database Driver & Version: MySql

@fletch3555 thank you for your detailed answer,i have same issue at show avatar ,i try change my config/filesystems.php file

'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage/app/public',
            'visibility' => 'public',
        ],

i have chagned the disk -> public -> url value env('APP_URL').'/storage' to env('APP_URL').'/storage/app/public',it works for me

This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TXRRNT picture TXRRNT  路  3Comments

kevinjon27 picture kevinjon27  路  3Comments

wislem picture wislem  路  3Comments

abacram picture abacram  路  3Comments

winex01 picture winex01  路  3Comments