3
votes

In my Laravel website image name is

images/campaign/4965d649233e1436ece21804ff4eb62b.jpeg

Actual image path is http://localhost/fund/storage/app/images/campaign/4965d649233e1436ece21804ff4eb62b.jpeg

But in my blade template when I use this path it automatically converted into http://localhost/fund/storage/app/images%2Fcampaign%2F4965d649233e1436ece21804ff4eb62b.jpeg

That's why my image is not shown.

Img src code in blade template

src="{{url('/storage/app',$response->large_image)}}" 

Why / is automatically replaced by %2F and how to solve it?

Anyone help please?

2
Do you echo the path of the image like {!! $image_name !!} or like {{ $image_name }}? - Douwe de Haan
@DouwedeHaan.. like second one {{ $image_name }} - Arafat Rahman
Hmm, can you append your code to your question? Like the part of the script where the path is echoed? - Douwe de Haan
@DouwedeHaan..update my post..please check - Arafat Rahman

2 Answers

4
votes

Change the blade to the following:

src="{{url('/storage/app/'.$response->large_image)}}"

I've changed the comma to a dot, which appends the path of the image to the /storage/app part, so it doesn't encode that last part.

0
votes

no need to use a concatenation when you use double quotes instead of single quotes

src='{{url("/storage/app/$response->large_image")}}'