简体   繁体   English

将图像添加到 Laravel 中的 email 模板中

[英]Add images into email template in Laravel

I´m trying to add img into Blade email in Laravel.我正在尝试将img添加到 Laravel 中的 Blade email 中。 But when I receive my email, I can´t see my image, but URL is correct.但是当我收到我的 email 时,我看不到我的图像,但 URL 是正确的。 I´m trying to add img this way:我正在尝试以这种方式添加img

<img src="{{ asset('/public/images/guiapaladar-qrcode.png') }}" alt="" style="width: 20%;">

In Google Console I can see this:在 Google 控制台中,我可以看到:

<img src="https://ci5.googleusercontent.com/proxy/-Ay7pcevYLhUaAu4iicFdd-kGPKGB9hXRemwYYmoes8GnA4nN6Qe_FZDKenf_iDgiNpx5Xb1QX7p_2Su5DCOHAb2-UI8gGHkJhK9V6qb4R-B6_QY=s0-d-e1-ft#http://127.0.0.1/guiaPaladar/public/images/guiapaladar-qrcode.png" alt="" style="width:20%" class="CToWUd">

but in my email it doesn't show my image.但在我的 email 中,它没有显示我的图像。

Thanks for help me谢谢你帮助我

If you are sending email through localhost then image will not be displayed.如果您通过 localhost 发送 email,则不会显示图像。 But if you are sending it live then use the following code:但是,如果您要实时发送,请使用以下代码:

<img src="{{asset('images/guiapaladar-qrcode.png')}}" alt="" style="width: 20%;">

With using markdown you can just:使用 markdown 您可以:

![Random text][logo]

[logo]: {{asset('/images/image.png')}} "Logo"

Or simply:或者简单地说:

<img src="data:image/png;base64,{{base64_encode(file_get_contents(resource_path('images/image.png')))}}" alt="">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM