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

derkraizer's avatar

Laravel does not display images in the view from storage folder

So, guys, I and a friend are working on the same project. We are using GitLab, the same repository, one branch. I used storage:link command to use a shortcut of the storage folder in the public folder of laravel.

The problem is that via this code: <img src="/storage/public/cover_images/{{ $book->image }}"

I can see/store only my images and not the images my friend uploads, the same applies for him - he sees/stores only the images he uploads but not mine. What might be the problem?

0 likes
18 replies
zak's avatar

So you're editing the repository but you each have it installed on your machine?

Are you trying to upload something to commit it to the repository? Laravel by default ignores the storage directory when using version control. Is this what you are talking about?

MarkLL's avatar

@derkraizer try <img src="{{ asset('storage/cover_images/'. $book->image) }} ... > or just this which is the same without the protocol. "/storage/cover_images/{{ $book->image }}"

1 like
munazzil's avatar

Have you tried with below.If your using with asset no need to give storage/public.

    <img src="{{ asset('cover_images/'. $book->image) }}"/>

else use a additional '/' as like below

           <img src="{{ asset('/cover_images/'. $book->image) }}"/>
mac03733's avatar

i recomend you use this syntax

 <img src="{{ asset('storage/cover_images/'. $book->image) }} ... >

as suggested by @markll

if the above doesnt work

inspect th link in your browser where the image is suppose to be ...and check if its geting th correct url ..with a name of an image thats actually in you cover_images folder

jlrdw's avatar

I can see/store only my images and not the images my friend uploads

Means there is no way they are being stored in the same folder on the same machine.

Have you checked the folder to make sure they are there.

derkraizer's avatar

@ZAK - What I am trying to say is that he does not get my images and I am not getting his images. I am aware of the fact that GIT does not store them but I want to be able to see his images and he should be able to see mine.

MarkLL's avatar

Can you see the file in the storage/app/public/cover_images folder? this should be the actual location where the files are saved assuming you used something like Storage::disk('local')->put('cover_images/' . $book->image', 'Image Contents'); to place it there. If it is there, check that the link is setup correctly.

derkraizer's avatar

@MAC03733 - src="/storage/public/cover_images/didi-1544606640.png" this is the link it gets. It is the same for him but still, we don't see each other's images

munazzil's avatar

Then use,

       <img src="{{asset('/storage/public/cover_images/'.$book->image )}}"/>
derkraizer's avatar

Still, it works for me, but he does not see the image I upload.

derkraizer's avatar

@MARKLL - if($request->hasFile('image')){ $filenameWithExt = $request->file('image')->GetClientOriginalName(); $filename=pathinfo($filenameWithExt,PATHINFO_FILENAME); $extension=$request->file('image')->getClientOriginalExtension(); $filenNameToStore=$filename. '-' .time(). '.' .$extension; $path=$request->file('image')->storeAs('public/cover_images',$filenNameToStore); } else { $filenNameToStore='default.jpg'; }

munazzil's avatar

Then it could be error in blade.php. view part.

kuns25's avatar

I Suggest you to link your storage folder to public folder by using php artisan storage:link command

then try

` <img src="{{ asset('storage/public/cover_images'. $book->image )}}"

`

zion's avatar

Are you both uploading files on your local dev or is the project somewhere on a machine you can both access such as a webserver?

munazzil's avatar

Can you guys show your images folder path? and one is working remotely ?

Please or to participate in this conversation.