I am trying to include an image in my web application but it is not showing up properly on my browser(localhost:3000). Have I set it up wrongly?

This is my view code:

    <div class="row">
                <div class="col-sm-4">
                    <img src="‪assets/img/Lab Potion.png" alt="#" class="img-responsive">
                    <h2>random text</h2>
                    <p>random text</p>
                </div>
    </div>

I downloaded an image and saved it under:

-Desktop
 -rails_projects
  -project_name
   -app
    -assets
     -images

When I check in the images folder there is a file named Lab Potion.png and a bunch of random numbers inside(fingerprint?)

Why is the image not showing up?

有帮助吗?

解决方案

<%= image_tag('Lab_Potion.png', :style => "z-index:19; position: relative; float: right;") %> will work. get rid of the space in the file name too, if not just for my sanity.

The random numbers are like a security feature and on each precompile the numbers end up changing. It's more complicated than that, but that is the gist.

And lastly, i doubt you have a img folder as well.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top