display images from filesystem without plugins

i want to know how i can displays images from the filesystem without
having to install any plugins. i imagine this should be fairly simple,
but i am having a hard time figuring out how to do it. could anyone
help? thank!

Leandro Tracchia wrote:

i want to know how i can displays images from the filesystem without
having to install any plugins. i imagine this should be fairly simple,
but i am having a hard time figuring out how to do it. could anyone
help? thank!

Hi,

you can use image_tag, the code below looks for the rails.png located at
/public/images/

<%= image_tag("rails.png") %>

Andreh Luis wrote:

Leandro Tracchia wrote:

i want to know how i can displays images from the filesystem without
having to install any plugins. i imagine this should be fairly simple,
but i am having a hard time figuring out how to do it. could anyone
help? thank!

Hi,

you can use image_tag, the code below looks for the rails.png located at
/public/images/

<%= image_tag("rails.png") %>

I had a feeling it was going to be that easy, lol... Thanks!

one more question, however,

what if the file name is a variable? for example i want to do something
like this...

<%= image_tag("stamps/@stamp.name") %> (but this won't work)

figured it out

<%= image_tag("stamps/" + @stamp.name) %>

looks like i still have a lot of learning to do!

Leandro Tracchia wrote:

figured it out

<%= image_tag("stamps/" + @stamp.name) %>

looks like i still have a lot of learning to do!

you can use the following to instead of the "+"

<%= image_tag("test/#{@image_test}") %>

Andreh Luis wrote:

Leandro Tracchia wrote:

figured it out

<%= image_tag("stamps/" + @stamp.name) %>

looks like i still have a lot of learning to do!

you can use the following to instead of the "+"

<%= image_tag("test/#{@image_test}") %>

that worked too!