view raw
user2211703 user2211703 - 9 months ago 60
Ruby Question

Ruby/Sinatra/erb: 404 for laoding image

i try to display a image but the response code is 404 in the log:

0:0:0:0:0:0:0:1 - - [02/Nov/2013 11:23:55] "GET /public/images/gtk_refresh.png HTTP/1.1" 404 466 0.0030
0:0:0:0:0:0:0:1 - - [02/Nov/2013:11:23:55 MEZ] "GET /public/images/gtk_refresh.png HTTP/1.1" 404 466
http://localhost:4567/main-> /public/images/gtk_refresh.png

rb file:

get '/main' do
erb: main

erb file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "

<html xmlns="">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>hello world</title>

<img src="public/images/gtk_refresh.png" />

i tried relative and absolute path to the image, bit it didn't work.



<img src="public/images/gtk_refresh.png" />


<img src="/images/gtk_refresh.png" />