Topic: display image in layout [solved]

Greetings all
I have a layout for my app.  It was created by Rails when the app was created.  I want to display a banner-image at the top of my page.  I created a div in the body tag to hold my image.

<div style="width: 650px; height: 100px; float: left; margin: 4px;">
  <img src="images/banner-image.jpg" width="640" height="100" />
</div>

I have my image in the public/images/ directory.  When I view a page in my browser I get a broken-image.  On inspection, the path seen by the browser is:

http://localhost:3000/customers/7/images/banner-image.jpg

I'm assuming the path should be: (??)

http://localhost:3000/images/banner-image.jpg

How should code my image tag so it will show my banner-image?

Thanks for any tips.

Last edited by johndc (2012-03-09 08:11:05)

Re: display image in layout [solved]

I calling from your root directory, change your <img> tag's src to this:

<img src="/images/banner-image.jpg" width="640" height="100" />

Notice the / before the image's src?

Hope that helps some smile

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!

Follow me!

Re: display image in layout [solved]

wesf90: 
Thank you.  So easy, so blind.
That was it.
Much appreciated.

Re: display image in layout [solved]

johndc wrote:

wesf90: 
Thank you.  So easy, so blind.
That was it.
Much appreciated.

Not a problem, paths are annoying smile

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!

Follow me!

Re: display image in layout [solved]

How do I edit the topic title to mark this resolved?

Re: display image in layout [solved]

johndc wrote:

How do I edit the topic title to mark this resolved?

Underneath your original post's content, you'll see "edit". smile It just helps the forum a little more tidy

Remember to edit your topic title and add "[SOLVED]" if your question has been answered!

Follow me!