From: Haris Bogdanovi� on
Hi.

I have this piece of code:
---------------------------------------------------------------------
(defun start-page ()
(cl-who:with-html-output-to-string (*standard-output* nil :indent t)
(:html
(:body
(:image :alt "alt" :src "file:///c:/pics/image01.jpg")))))
-----------------------------------------------------------------------
and when I go to http://localhost:5000, where my hunchentoot is,
it just renders alternative text "alt" but if copy source code that is
produced by this:
-------------------------------------------------------------------
<html>
<body>
<image alt='alter' src='file:///c:/pics/image01.jpg'></image>
</body>
</html>
--------------------------------------------------------------------------------
and put it in a new html file (a.html for example) and then douible click on
that file
then firefox renders the picture instead of alternative text.
Why doesn't it render a picture in the first case ?

Thanks



From: RG on
In article <hvr60h$ghs$1(a)gregory.bnet.hr>,
"Haris Bogdanoviæ" <fbogdanovic(a)xnet.hr> wrote:

> Hi.
>
> I have this piece of code:
> ---------------------------------------------------------------------
> (defun start-page ()
> (cl-who:with-html-output-to-string (*standard-output* nil :indent t)
> (:html
> (:body
> (:image :alt "alt" :src "file:///c:/pics/image01.jpg")))))
> -----------------------------------------------------------------------
> and when I go to http://localhost:5000, where my hunchentoot is,
> it just renders alternative text "alt" but if copy source code that is
> produced by this:
> -------------------------------------------------------------------
> <html>
> <body>
> <image alt='alter' src='file:///c:/pics/image01.jpg'></image>
> </body>
> </html>
> ------------------------------------------------------------------------------
> --
> and put it in a new html file (a.html for example) and then douible click on
> that file
> then firefox renders the picture instead of alternative text.
> Why doesn't it render a picture in the first case ?
>
> Thanks

I'm surprised either one works. IMAGE is not a valid HTML tag. You
want IMG instead. But if it really does work as a file but not when
served then I would suspect a problem with the content-type header.

rg
From: Haris Bogdanovi� on
I put img instead of image and put the image in lispworks working dir
and tried relative pathname to the image but no success.
I guess hunchentoot has it's own current working dir
so I should put my picture in that directory.
How do I find out or set that directory ?


From: Thomas A. Russ on
"Haris Bogdanovi��" <fbogdanovic(a)xnet.hr> writes:

> Hi.
>
> I have this piece of code:
> ---------------------------------------------------------------------
> (defun start-page ()
> (cl-who:with-html-output-to-string (*standard-output* nil :indent t)
> (:html
> (:body
> (:image :alt "alt" :src "file:///c:/pics/image01.jpg")))))
> -----------------------------------------------------------------------
> and when I go to http://localhost:5000, where my hunchentoot is,
> it just renders alternative text "alt" but if copy source code that is
> produced by this:
....
> Why doesn't it render a picture in the first case ?

Because we don't have your picture installed on our machines. And a lot
of us aren't running Windows either, so even if we had your picture it
would have a different file path.

You need to point the image tag at a web-accessible URL and not at your
local file system. We can't just randomly retrieve stuff from your file
system (I'll bet you're glad about that).

So put the picture somewhere that huchentoot will serve it and get to it
with an http: URL instead.


--
Thomas A. Russ, USC/Information Sciences Institute
From: Rupert Swarbrick on
"Haris Bogdanoviæ" <fbogdanovic(a)xnet.hr> writes:

> I put img instead of image and put the image in lispworks working dir
> and tried relative pathname to the image but no success.
> I guess hunchentoot has it's own current working dir
> so I should put my picture in that directory.
> How do I find out or set that directory ?

The answer from Hannah is right. Would you like it if going to
http://www.evilhaxors.com allowed them to force your browser to access
any file on your file system (via sticking it in an <img> tag's href
attribute)?

The point is that http://localhost:5000 or whatever is treated as an
internet address, whereas the html file you load straight from the hard
drive is a local file (and seemingly allowed to refer to a literal
file:/// url).

This is not related to the fact you're serving it from hunchentoot I
don't think.

Rupert