# Image\_tag

**URL:** <https://www.ruby-forum.com/t/image-tag/129152>\
**Category:** Rails\
**Created:** [February 14, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/image-tag/129152 "2008-02-14T22:54:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 14, 2008, 10:54pm UTC](https://www.ruby-forum.com/t/image-tag/129152/1 "2008-02-14T22:54:41Z")

</div>

I have an table with a background image but I do not know how to load  
the image.

In general I use a code line like  
“

”  
but this do not work, because the directory changes, for example if I  
open a sub page of my controller, the picture is gone. Please just tell  
me how to use the image\_tag with the background tag in html.

Regrades Snoop1990

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 14, 2008, 10:58pm UTC](https://www.ruby-forum.com/t/image-tag/129152/2 "2008-02-14T22:58:55Z")

</div>

Image tag generates \<img src=\> i’m pretty sure.

Why are you doing …/? Just make it /

On Feb 14, 3:54 pm, Snoop1990 Snoop1990 \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 14, 2008, 11:00pm UTC](https://www.ruby-forum.com/t/image-tag/129152/3 "2008-02-14T23:00:41Z")

</div>

> I have an table with a background image but I do not know how to load  
> the image.
> 
> In general I use a code line like  
> “
> 
> ”  
> but this do not work, because the directory changes, for example if I  
> open a sub page of my controller, the picture is gone. Please just tell  
> me how to use the image\_tag with the background tag in html.
> 
> image\_path(“edit.png”) # =\> /images/edit.png  
> image\_path(“icons/edit.png”) # =\> /images/icons/edit.png  
> image\_path("/icons/edit.png") # =\> /icons/edit.png

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 14, 2008, 11:27pm UTC](https://www.ruby-forum.com/t/image-tag/129152/4 "2008-02-14T23:27:00Z")

</div>

Philip H. wrote:

> image\_path(“edit.png”) # =\> /images/edit.png  
> image\_path(“icons/edit.png”) # =\> /images/icons/edit.png  
> image\_path("/icons/edit.png") # =\> /icons/edit.png

I tried \<td height=“150” background=" \<=%image\_path(“1.png”)%\> "\>  
but it does not work ! How to tell ruby on rails it should render the  
command when using it inside a html command ?

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 14, 2008, 11:46pm UTC](https://www.ruby-forum.com/t/image-tag/129152/5 "2008-02-14T23:46:40Z")

</div>

"\>

Well, it’s supposed to be \<%=, but that was probably a typo.

On Feb 14, 4:27 pm, Snoop1990 Snoop1990 \<rails-mailing-l…@andreas-

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 17, 2008, 9:10am UTC](https://www.ruby-forum.com/t/image-tag/129152/6 "2008-02-17T09:10:43Z")

</div>

Steve wrote:

> From your example, it looks like you’ve got double quotes (") nested  
> inside other double quotes.
> 
> Have you tried:
> 
> -Steve
> 
> Thank you very much, it is all working now !  
> Regrades Snoop1990

---

<div class="post-metadata">

**Author:** ![snoop1990](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/fbc32d/32.png) [@snoop1990](https://www.ruby-forum.com/u/snoop1990)\
**Post date:** [February 17, 2008, 1:11am UTC](https://www.ruby-forum.com/t/image-tag/129152/7 "2008-02-17T01:11:51Z")

</div>

From your example, it looks like you’ve got double quotes (") nested  
inside other double quotes.

Have you tried:

-Steve
