Voyager: Voyager::image function - Storage::disk( not returning url with port no

Created on 16 Apr 2017  ยท  12Comments  ยท  Source: the-control-group/voyager

img-url

  • Laravel Version: 5.4..13
  • Voyager Version: v0.11.3
  • PHP Version: 7
  • Database Driver & Version: NA

Description:

your url method used not getting reference of port no
so all images path broken,
this may also due to Storage::disk(config('voyager.storage.disk'))->url($file);

Steps To Reproduce:

php artisan server --port=8001

http://127.0.0.1:8001/admin/posts

returning:
http://localhost/storage/posts/7uelXHi85YOfZKsoS6Tq.jpg

so without port in url image broken,
even though image file exits

All 12 comments

Can you show me your APP_URL in .env ?
Anyway, I tried different port and that still work in mine.

screen shot 2017-04-17 at 5 18 54 pm

APP_URL is likely set incorrectly as @uchsarath mentioned. Please check this and respond here whether this is resolved.

Its working now. have to explicit
APP_URL=http://127.0.0.1:8001

@uchsarath You just need to restart the server after you change in .env file

@tamersolieman, this issue has been closed for nearly a year. Your comment adds nothing to it. Please refrain from doing so

@tamersolieman thank you for adding your comment, it helped me.

there is no way to make voyager get the current port? Instead of hardcoding it?

Thats a Laravel limitation(or feature), not specific to Voyager

๐Ÿ‘ ..ok

If you recently changed the port in .env and are having troubles with the port, maybe all you need to do is kill and restart artisan serve, so laravel can pick up the new port.

On 30 Nov 2018, at 04:08, Adriel Werlich notifications@github.com wrote:

there is no way to make voyager get the current port? Instead of hardcoding it?

โ€”
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

my problem is that Iยดm running on different ports and Iยดm having to change every time the port in the APP_URL in the .env file...
so the avatars pictures arenยดt showing if I do not change

What you're describing is a limitation in how Laravel renders asset URLs, and is only tangentially related to Voyager, so I'm going to have to stop the discussion here. Feel free to discuss all you want in slack or elsewhere if you wish.

I will say, however, that if your port is changing all the time, you need to take a closer look at your deployment process and webserver configuration. Perhaps you need a proxy layer to provide a consistent endpoint

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vaggelis2018 picture vaggelis2018  ยท  3Comments

rayqiri picture rayqiri  ยท  3Comments

Nagendra1421 picture Nagendra1421  ยท  3Comments

jeulun picture jeulun  ยท  3Comments

iwasherefirst2 picture iwasherefirst2  ยท  3Comments