Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aurelianspodarec's avatar

Cant load images to show in Laravel

Hi there!

So I'm using Spatie, and I uploaded the image, I did simlink and now I'm trying to display the image on the front-end.

Images can be found in the public folder, I'm not sure why they won't display.

This is what I got: $image->getFirstMediaUrl('image')

And it does retrieve the URL "http://localhost/storage/6/VX554HPPPeZeNrC56n0MaO5sxYKQQL-metaMTY1NDA5Njc0MTQyMi5qcGVn-.jpg" not sure why that won't display as an actual image though, but shows broken.

0 likes
12 replies
jlrdw's avatar

I've had good luck with the asset helper:

<img src="{{ asset('upload/imgdogs') . '/' . $row->dogpic }}" alt="" class="image">

Just example:

But I don't know if your symbolic link is correct.

2 likes
aurelianspodarec's avatar

@jlrdw Yeah, I got this:

<img  src="{{ asset( $image->getFirstMediaUrl('image')) }}"

I did try 'uploads' before etc... but didn't work either.

Well, the files are in the public folder so I suppose it worked right?

Its in:

/public
/ storage, 1, img

But also in app/storage.

So what should I check or do in this instance? How do you go about debugging this?

Snapey's avatar

Your site is loaded at localhost, port 80?

is that filename seen in the public/storage folder?

1 like
Snapey's avatar

@aurelianspodarec but not served?

So, if you open your browser network tools, you see a red entry for this file. Check the exact URL. Check the location and name of the file.

By the way, when you access pages of your site, you DONT see 'public' in the URLs ?

2 likes
aurelianspodarec's avatar

@Snapey

Sometimes it shows:

VX554HPPPeZeNrC56n0MaO5sxYKQQL-metaMTY1NDA5Njc0MTQyMi5qcGVn-.jpg	404	text/html	pages

and sometimes it shows

Image storage/	403	text/html	storage

I did check permission and it says in windows properties/securty that it has read and all selected and the folder is symlinked/shortcut.

The image doesn't get served.

Wellll, so far all of my images been server via links, now I'm actually doing this via the database.

My config file looks like this:

 'disks' => [

        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

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

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

@Snapey When I tried to change the env file... that worked for whatever reason.

But I did check the env file before asking xd not sure, maybe I mistyped something or whatever, but now trying it again so I can show you the error and it worked xd

Thank you ^^

aurelianspodarec's avatar

@Snapey Oh no, I wrote that poorly.

I meant that I did change this before asking the question, but it didn't work for whatever reason.

So when I changed to localhost, I didn't get the same error as before, so I though maybe indeed this needs to be on localhost, the env file.

So I'mnot sure if I mistyped the URL in the env file before asking, because now when I did this, it worked.

I wanted to show you the error, so I was going to put the URL again, but this time for whatever reason it worked. So maybe I've mistyped it first time or something.

Please or to participate in this conversation.