views:

95

answers:

1

I'm looking for an image url helper for sinatra that allows me to do something similar to staticmatic's, where I can shortcut to a relative path like so...

=img "me.jpg"

Can anybody point me in the direction to where this might be online, or where I could learn how to write one, or provide an example of one they have already written

Many thanks

A: 

Depending on what you want, you could use sinatra-static-asset or a helper like this:

helpers do
  def img(name)
    "<img src='images/#{name}' alt='#{name}' />"
  end
end
Konstantin Haase
Awesome that is exactly what I was after, thanks
Dr. Frankenstein