【问题标题】:rails image_tag not working导轨 image_tag 不起作用
【发布时间】:2012-01-13 02:16:50
【问题描述】:

更新:有谁知道为什么图片在 Firefox 中显示,但在 Chrome 中不显示?

我刚刚在 Firefox 中测试了我的应用程序并显示了图像!但它们不会出现在 Google Chrome 中。有谁知道这是为什么?

发布到 Ruby-on-Rails 和 Ruby..below 行的原始问题


好的,所以我对 rails 中的 image_tag 感到厌烦。我的 index.html.erb 中有以下代码

代码在..

<% @most_recent_tweets.each do |tweet| %>
    <%= image_tag (tweet["user"]["profile_image_url"]) %>
<% end %>

以下是实际网页上出现的内容

代码输出..

<img alt="Eli_face_1_bigger_normal" src="http://a2.twimg.com/profile_images/498988018/eli_face_1_bigger_normal.jpg">

图像的 html 显示在代码中,但没有图像显示在浏览器中。为什么是这样?有什么想法吗?

【问题讨论】:

标签: ruby-on-rails firefox google-chrome


【解决方案1】:

尝试添加 .html_safe

image_tag (tweet["user"]["profile_image_url"]).html_safe

【讨论】:

  • 嗯仍然没有奇怪,我只是在 Firefox 中测试了它,图像就出现了!更奇怪。
猜你喜欢
  • 2015-10-25
  • 2011-11-14
  • 1970-01-01
  • 2011-06-05
  • 1970-01-01
  • 1970-01-01
  • 2023-03-12
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多