电子邮件中的图像使用路边宝石 [英] images in emails using roadie gem

查看:154
本文介绍了电子邮件中的图像使用路边宝石的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用路边宝石在电子邮件中显示图像。使用路易,我可以内联我的样式表,但它不显示图像。我已尝试过

 <%= image_tagpic.jpg%> 

 < img src =pic.jpg/>或< img src =assets / images / pic.jpg/> 

我的邮件模板,但它没有显示任何图像。任何帮助?

解决方案

我问了这个问题已经很久了,真的知道我在做错什么无论如何,当我们使用image_tag帮助器或asset_path帮助器渲染图像时,问题是 ,它使该图像的相对路径(您可以在firebug或其他工具中查看),并且他们赢得了在任何其他远程服务器(应用程序所在的地方除外)可以在电子邮件中进行操作。



修复: / p>

您可以通过以下方式指定资产的托管位置:

  config。 action_controller.asset_host ='http://your_server.com'


I want to know how to show images in email by using roadie gem. Using roadie i'm able to inline my stylesheets but it's not showing images. I have tried both

<%= image_tag "pic.jpg" %>

and

<img src="pic.jpg"/> or <img src="assets/images/pic.jpg"/>

inside my mail template, but it's not showing any of the images. Any help?

解决方案

It's been a long time since I asked this question and I was pretty new to rails development so didn't really know what I was doing wrong. Anyways so the issue is when we use image_tag helper or asset_path helpers for rendering images, it makes relative paths for that image(you can check it in firebug or some other tool) and they won't work inside emails or lets say on any other remote server (other than where the app is hosted)

Fix:

You can specify where your assets are hosted by:

config.action_controller.asset_host = 'http://your_server.com'

这篇关于电子邮件中的图像使用路边宝石的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆