gravatar won't get my image - laravel-5

i am using this package<
thomaswelton/laravel-gravatar
yes its working good when i use this code
<img src="{{ Gravatar::src('imsidzluv#gmail.com') }}" class="img-circle img-responsive">
but its a static image so i trying to change this to dynamic like this
<img src="{{ Gravatar::src('{!! Auth::user()->email !!}') }}" class="img-circle img-responsive">
and
<img src="{!! Gravatar::src('{{ Auth::user()->email }}') !!}" class="img-circle img-responsive">
this won't work why any solution

The reason that it's not being loaded is actually you are passing the whole {!! Auth::user()->email !!} argument as a string so that it's not being printed as you may think for the static Gravatar src function.
Just pass it like below.
<img src="{{ Gravatar::src(Auth::user()->email) }}" class="img-circle img-responsive">

Related

Convert Blade If Else to Vue If Else

I have an if else condition in Blade and I want to convert it to a Vue if else
#if (Auth::user()->avatar != null)
<img src="{{ URL::to('storage/app/public') . '/' . Auth::user()->avatar }}"
class="img-circle elevation-2" alt="User Image">
#endif
#if (Auth::user()->avatar == null)
#if (Auth::user()->gender == 'Male')
<img src="{{ URL::asset('public/bower_components/admin-lte/dist/img/fb-male.jpg') }}"
class="img-circle elevation-2" alt="User Image">
#else
<img src="{{ URL::asset('public/bower_components/admin-lte/dist/img/female-fb.jpg') }}"
class="img-circle elevation-2" alt="User Image">
#endif
#endif
To convert the #if branches in your blade file, use <template>s with v-if/v-else:
<template v-if="{{ Auth::user()->avatar != null }}">
<img src="{{ URL::to('storage/app/public') . '/' . Auth::user()->avatar }}"
class="img-circle elevation-2" alt="User Image">
</template>
<template v-else>
<template v-if="{{ Auth::user()->gender == 'Male' }}">
<img src="{{ URL::asset('public/bower_components/admin-lte/dist/img/fb-male.jpg') }}"
class="img-circle elevation-2" alt="User Image">
</template>
<template v-else>
<img src="{{ URL::asset('public/bower_components/admin-lte/dist/img/female-fb.jpg') }}"
class="img-circle elevation-2" alt="User Image">
</template>
</template>

Laravel | More than one CubePortfolio gallery in blade's view

how can I add more CubePortfolio gallery in my view. My code:
#foreach($page->subpages as $subpage)
<div id="js-grid-lightbox-gallery" class="cbp ">
#foreach($subpage->photos as $photo)
<div class="cbp-item {{ $subpage->id }}">
<a href="/project/storage/app/{{ $photo->filename }}" class="cbp-caption cbp-lightbox" data-title="" rel="nofollow">
<div class="cbp-caption-defaultWrap">
<img src="/project/storage/app/{{ $photo->filename }}" alt="">
</div>
</a>
</div>
#endforeach
</div>
#endforeach
currently only shows one gallery to me, and should display multiple galleries. One is ok, the other revolves around the loader.
I understand that there cannot be two galleries with the same ID? How can I solve this problem? Thanks for the help.
Append an identifier from the loop to the ID, the same way you do that with the class
<div id="js-grid-lightbox-gallery-{{ $subpage->id }}" class="cbp">
Then initialize the element like so (example from jQuery)
$('[id^=js-grid-lightbox-gallery]').cubeportfolio({
Hope this helps

Laravel how can i display all image with slider from my public folder?

hello i want to show all image from public folder with slider.That's show all image code
<img src="{{ asset('images/' . $image->getFilename()) }}"
controller
$images = \File::allFiles(public_path('images'));
return view('welcome')->with('images',$images);
i want to show that all image with slide can anyone show me sample.
You can use owl carousel, in your welcome.blade.php
<div class="owl-carousel owl-theme">
#foreach($images as $image)
<div class="item"><img src="{{ asset('images/' . $image->getFilename()) }}" /></div>
#endforeach
</div>

Rendering images in Twig

I have a form which takes Image (png file type) and saves it's name in the database. The image is uploaded to web/uploads/Images/ directory, my question is, how do I render this image in my Twig template? This is what I have so far:
<div class=products>
{% for key,product in products %}
<div class="product-{{ key }}">
<div class="p-name"> {{ product.name }}</div>
<div class="p-price"> {{ product.price }}</div>
<div class="p-description"> {{ product.description }}</div>
<div class="p-image">
<img src="{{ asset('uploads/Images/' ~ product.Image) }}"></img>
</div>
</div>
{% endfor %}
</div>
And this is what I have in DOM
I am completely new to Symfony, so please bear with me.
EDIT: The path to the image is wrong, how should it be written?
In your img tag you have the spelling of "src" incorrect. Should be like so:
<img src="{{ asset('uploads/Images/' ~ product.Image) }}"></img>
Maybe that's the problem? Otherwise, it looks correct.

Interpolating variables in jekyll/liquid with jekyll-assets

I have a list of articles in my data and one of the fields is a link to an image. I'm using jeykll-assets, and I would like to load the images using the asset_path. However, the following isn't working:
{% for article in site.data.press %}
<div class="press-item">
<div class="press-image">
<div class="centerit"></div>
<a href="{{ article.url }}" target="_blank">
<img src="{% asset_path article.logo %}" />
</a>
</div>
<div class="press-excerpt">
<a href="{{ article.url }}" target="_blank">
<p>{{ article.title }}</p>
</a>
</div>
<div class="date">{{ article.date }}</div>
</div>
{% endfor %}
Specifically <img src="{% asset_path article.logo %}" /> because it doesn't load article.logo dynamically. What's the correct way to do this?
Use brackets like this : <img src="{% asset_path {{ article.logo }} %}" />
See https://github.com/jekyll/jekyll-assets#liquid-variables

Resources