Avatar Not Showing Laravel - laravel

I'm working with laravel framework, I have to create a profile so I changed the table User created in the Auth.. all works perfectly. I also added a Picture for the Profile picture or Avatar in the User table.
I made a profile page Image are showing and even to my nav bar.
this is the code I used.. and it work in other pages.
<img src="img/avatar/{{Auth::user()->picture}}">
this one is for my logo image I put the {{URL::asset}} because it's not showing also in another pages
<img src="{{ URL::asset('img/weblogo.png') }}">
then it works perfectly in all pages
but when I try to use it in the image from my database, It won't work and said
<img src="{{ URL::asset('img/avatar/{{Auth::user()->picture}}') }}">
syntax error, unexpected '}', expecting ')'
in my view
but when I try this, it won't work with all the pages
<img src="img/avatar/{{Auth::user()->picture}}">

Set asset as below
<img src="{{ asset('img/avatar/'.Auth::user()->picture) }}">
Or if you want to use URL::asset then
<img src="{{ URL::asset('img/avatar/'.Auth::user()->picture) }}">

You don't need to use {{ again inside {{ }}
Change
<img src="{{ URL::asset('img/avatar/{{Auth::user()->picture}}') }}">
to
<img src="{{ URL::asset('img/avatar/'.Auth::user()->picture) }}">

Related

Inserting laravel 8 translator inside HTML <img> tag

I have two versions of profile page. All are images and I want to insert #lang() so I can fetch the images belonging to the current language. Every time I make it, an error of syntax error, unexpected identifier "translator", expecting ")" appears.
<img src="{{ asset('home/theme/img/about/#lang('auth.profile-ar')/01.jpg') }}">
Can someone tell how the right way to do it?
This will work
<img src="{{ asset('home/theme/img/about/'.__('auth.profile-ar').'/01.jpg') }}">
You cannot use the #lang blade directive (or any other blade directive) inside a string like that.
Use the translation function __() like this instead:
<img src="{{ asset('home/theme/img/about/'.__('auth.profile-ar').'/01.jpg') }}">

Laravel profile photos show only sometimes

I have a profile photo set up in a std header like so
<img src="{{ Auth::user()->profile_photo_url }}" class="img-circle" alt="User Image" />
When I sign in and land on my dashboard page using this header everything works great.
When I route to any other screen using the same header the picture does not show.
If I inspect the img src I get the same img src from all screens wether the picture shows up or not.
Any insight would help.
<img src="storage/profile-photos/1715359786021735.png" class="user-image" alt="User Image">

How to us html <img src> to display an image in laravel?

I am trying to src an image into my html. Using Laravel as a backend.
<img class="card-img-top" src="storage/app/public/photos/{{$photo}}" alt="Card image cap">
I have also used the system link command and tried,
<img class="card-img-top" src="storage/{{$photo}}" alt="Card image cap">
In the past this would have been sufficent however, when using Laravel this does not link the image.
Does Laravel not allow direct 'src' links, or am I messing up the 'src' file structure?
Laravel uses blade syntax, variables ($) need to be between {{ }} in order to output their value.
So give <img class="card-img-top" src="storage/app/public/photos/{{ $photo }}" alt="Card image cap"> a try :)
i think the simple call like
<img src="storage/image/{{$data->photo}}" alt="">
$data = result from foreach
photo = column in db.
Correct file path is:
src="storage/photos/{{photo}}"
It skips /app/public
src="{{ url('assets/img') }}/{{ $item->photo }}"
Works for me!

show img with url in laravel 5.4

I have a image that want show in slide show I use html tag <img src="">,
I'm new in laravel and I don't Know How to show image in my blade.
How I can use <img> tag in laravel?
<img src="{{ asset('/public/upload/image.jpg') }}">
If your image in public folder
If you have stored images inside laravel public directory then, you can use asset which refers to public/ directory.
If you have image at public/images/abc.png then, you can add image in view like this:
<img src="{{ asset('images/abc.png') }}">

Support angular binding inside fineuploader template

I'm starting with fineuploader and I'm currently have an issue while integrating this awesome library in my angular application.
I have some angular expressions in my template:
<div id="simple-previews-template" style="display: none">
...
<div class="qq-upload-button-selector qq-upload-button small postfix">
{{ 'ACTION.BROWSE' | translate }}
</div>
...
{{ Upload.warn }}
</div>
But these expressions aren't replaced at all: my browser displays {{ 'ACTION.BROWSE' | translate }} and {{ Upload.warn }} instead of their values.
I firstly thought it was due to <script type="text/template" id="..."></script> tag, so I changed to <div id="..." style="display: none"></div> without effect.
How can I have angular binding working with fineuploader?
I'm also interested in knowing why it doesn't work ;)
Without seeing more of your code, it's hard to say exactly how to solve your issue. Most likely, you'll need to $compile the template against the proper $scope after it has been added to the DOM by Fine Uploader.
Also, I'm not exactly sure why you are including the template in a hidden <div>. It really should be a <script> with a type="text/template". See our Angular example at https://github.com/FineUploader/integration-examples/tree/master/src/angularjs-nodejs.

Resources