简体   繁体   English

Rails 4 image_tag无法从资源加载图像

[英]Rails 4 image_tag not loading Image from Assets

I have placed all my assets in the following folders 我已将所有资产放在以下文件夹中

app/assets/images/admin/*  <---- Admin Template
app/assets/images/default/* <----- Frontend Template

Now when i am trying to use the following code 现在,当我尝试使用以下代码时

<%= link_to image_tag('default/user-photo-medium-jpg', :class => 'media-object img-circle', :style => 'width: 64px; height: 64px;'), '#' %>

It generated the following code and the image does not load in the Development Environment. 它生成了以下代码,并且该图像未在开发环境中加载。

<a href="#"><img style="width: 64px; height: 64px;" src="/images/default/user-photo-medium-jpg" class="media-object img-circle" alt="User photo medium jpg"></a>

Your image source points to "/images/default/user-photo-medium-jpg". 您的图片来源指向“ / images / default / user-photo-medium-jpg”。 Are you sure that the image has correct ending (.jpg) and not -jpg? 您确定图像的结尾正确(.jpg)而不是-jpg吗?

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

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