# List image

**URL:** <https://www.ruby-forum.com/t/list-image/108537>\
**Category:** Rails\
**Created:** [July 4, 2007, 2:46pm UTC](https://www.ruby-forum.com/t/list-image/108537 "2007-07-04T14:46:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 2:46pm UTC](https://www.ruby-forum.com/t/list-image/108537/1 "2007-07-04T14:46:46Z")

</div>

Hi,

i’m trying to list an image taking the url from the DB.  
The code is:

\<img src=’\<%= image.image\_url %\>’ width="50"height=“75”\>

but it doesn’t show nothing…  
Can somebody help me??

thanks in advance

---

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/list-image/108537/2 "2007-07-04T15:27:08Z")

</div>

because you are in rails, why not write this:

\<%= image\_tag(image.image\_url, :size=\>“50x75”) %\>

and be sure the images exists. you can check this with the help of  
firebug, a great plug-in for firefox…

---

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 3:31pm UTC](https://www.ruby-forum.com/t/list-image/108537/3 "2007-07-04T15:31:51Z")

</div>

lanzm wrote:

> because you are in rails, why not write this:
> 
> \<%= image\_tag(image.image\_url, :size=\>“50x75”) %\>
> 
> and be sure the images exists. you can check this with the help of  
> firebug, a great plug-in for firefox…

The problem is how to add what’s kind of Url into database from web.

---

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 3:33pm UTC](https://www.ruby-forum.com/t/list-image/108537/4 "2007-07-04T15:33:05Z")

</div>

abdulKamel wrote:

> Hi,
> 
> i’m trying to list an image taking the url from the DB.  
> The code is:
> 
> \<img src=’\<%= image.image\_url %\>’ width="50"height=“75”\>
> 
> but it doesn’t show nothing…  
> Can somebody help me??
> 
> thanks in advance

I met the same problem with you.

I think the problme is the what’s content of image.image\_url?

Could you tell me what its content ?

---

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 3:46pm UTC](https://www.ruby-forum.com/t/list-image/108537/5 "2007-07-04T15:46:50Z")

</div>

> Could you tell me what its content ?

the content is:

/home/andrea/senior/public/images/prova.jpg

and it’s the right path…  
thanks

---

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 4:50pm UTC](https://www.ruby-forum.com/t/list-image/108537/6 "2007-07-04T16:50:00Z")

</div>

> It looks like you should remove RAILS\_ROOT+’/public’ from all of your  
> "url"s

thanks now it works!!!

---

<div class="post-metadata">

**Author:** ![abdulKamel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/87869e/32.png) [@abdulKamel](https://www.ruby-forum.com/u/abdulKamel)\
**Post date:** [July 4, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/list-image/108537/7 "2007-07-04T16:30:18Z")

</div>

On Jul 4, 2007, at 9:46 AM, abdulKamel wrote:

> > Could you tell me what its content ?
> 
> the content is:
> 
> /home/andrea/senior/public/images/prova.jpg
> 
> and it’s the right path…  
> thanks

You only want to give ‘/images/prova.jpg’ to the ![]() or image\_tag.  
The value is going to be interpretted by the browser so that PATH is  
not a URL. Unless your routes are also set up to catch this and  
you’re finding the file and using send\_file() to get it back. (NOTE:  
I’m _not_ recommending this!)

It looks like you should remove RAILS\_ROOT+‘/public’ from all of your  
"url"s

-Rob

Rob B. [http://agileconsultingllc.com](http://agileconsultingllc.com)  
removed\_email\_address@domain.invalid
