List image


#1

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


#2

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…


#3

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.


#4

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 ?


#5

Could you tell me what its content ?

the content is:

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

and it’s the right path…
thanks


#6

It looks like you should remove RAILS_ROOT+’/public’ from all of your
"url"s

thanks now it works!!!


#7

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
removed_email_address@domain.invalid