From: Haris Bogdanovi� on 23 Jun 2010 16:07 I have this piece of code: ------------------------------------------------------------------------------------------------------------------------- (hunchentoot:start (make-instance 'hunchentoot:acceptor :port 5000)) (push (hunchentoot:create-prefix-dispatcher "/" 'start-page) hunchentoot:*dispatch-table*) (push (hunchentoot:create-folder-dispatcher-and-handler "pics/" "c:") hunchentoot:*dispatch-table*) (defun start-page () (cl-who:with-html-output-to-string (*standard-output* nil :indent t) (:html (:body (:img :alt "alt" :src "pics/pic01.jpg"))))) -------------------------------------------------------------------------------------------------------------------------------- and when I go to http://localhost:5000 I don't see a picture, I see alternative text "alt". Why, where is the problem ?
From: szabolcs.szucs on 24 Jun 2010 09:36 Is there any HTML returned? What your browser says about the page's content? Cheers, Sz On Jun 23, 10:07 pm, "Haris Bogdanoviæ" <fbogdano...(a)xnet.hr> wrote: > I have this piece of code: > ------------------------------------------------------------------------------------------------------------------------- > (hunchentoot:start (make-instance 'hunchentoot:acceptor :port 5000)) > > (push (hunchentoot:create-prefix-dispatcher "/" 'start-page) > hunchentoot:*dispatch-table*) > (push (hunchentoot:create-folder-dispatcher-and-handler "pics/" "c:") > hunchentoot:*dispatch-table*) > > (defun start-page () > (cl-who:with-html-output-to-string (*standard-output* nil :indent t) > (:html > (:body > (:img :alt "alt" :src "pics/pic01.jpg"))))) > -------------------------------------------------------------------------------------------------------------------------------- > and when I go tohttp://localhost:5000I don't see a picture, I see > alternative text "alt". > Why, where is the problem ?
From: Jorge Gajon on 25 Jun 2010 11:47 On 2010-06-23, Haris Bogdanovi� <fbogdanovic(a)xnet.hr> wrote: > I have this piece of code: > ---------------------------------------------------------------------- > (hunchentoot:start (make-instance 'hunchentoot:acceptor :port 5000)) > > (push (hunchentoot:create-prefix-dispatcher "/" 'start-page) > hunchentoot:*dispatch-table*) > (push (hunchentoot:create-folder-dispatcher-and-handler "pics/" "c:") > hunchentoot:*dispatch-table*) > > > (defun start-page () > (cl-who:with-html-output-to-string (*standard-output* nil :indent t) > (:html > (:body > (:img :alt "alt" :src "pics/pic01.jpg"))))) > --------------------------------------------------------------------- > and when I go to http://localhost:5000 I don't see a picture, I see > alternative text "alt". > Why, where is the problem ? > > Hello Haris, Try this: (hunchentoot:create-folder-dispatcher-and-handler "pics/" "c:\\pics") I'm not sure if the path in "C:\\pics" should use a backward slash, I don't have a Windows machine here to test on. The first parameter is the URL prefix that you want to use to serve static files, while the second parameter is the location in your drive where these files are stored. For example if you you have these files: C:\pics\pic01.jpg C:\pics\foo\bar.jpg You could set a folder dispatcher like this: (create-folder-dispatcher-and-handler "my-awesome-pics/" "c:\\pics") Then in your html you can access your files like this: <img src="my-awesome-pics/pic01.jpg" /> <img src="my-awesome-pics/foo/bar.jpg" /> -- Jorge Gajon Mexico City http://gajon.org
|
Pages: 1 Prev: Learning Lisp Next: How to improve performance when reading text files? |