patrick
patrick

Reputation: 881

Laravel 4.1 blade linking to user profile picture

I am trying to link to a user profile image in Laravels blade template but I am only getting errors here.

This is my image tag containing the link:

<img class="img-circle dashboardprofileimage" src="{{ URL::asset('img/profile_pictures/users/{{ Auth::user()->profile_picture }}') }}"/>

I would be very happy if anyone could help me out here. I guess its a simple thing but I have tried quite a lot of times now.

Thanks.

Upvotes: 0

Views: 1924

Answers (2)

Gadoma
Gadoma

Reputation: 6565

Your error is using nested {{ }}, you just need it once. Check out the correct code below:

<img 
class="img-circle dashboardprofileimage" 
src="{{ 
URL::asset('img/profile_pictures/users/' . Auth::user()->profile_picture) 
}}" />

Note: it's splited into several lines for better legibility.

Upvotes: 3

ahmed hamdy
ahmed hamdy

Reputation: 5169

you just use {{ }} one time to print URL::asset() and Auth::user()

<img class="img-circle dashboardprofileimage" src="{{ URL::asset('img/profile_pictures/users/'.Auth::user()->profile_picture) }}"/>

Upvotes: 1

Related Questions