[hunchentoot-devel] Displaying an image in the text content

Going trough the test server code it's clear how to diplay an image based on a static handler or sending a raw image stream to the client. But how can show an image in context of a normal html page (surrounded by other text tags like <div> <table> etc)? Thank you, Andrew

On Thu, Feb 08, 2007 at 05:45:01PM -0500, Andrei Stebakov wrote:
Going trough the test server code it's clear how to diplay an image based on a static handler or sending a raw image stream to the client. But how can show an image in context of a normal html page (surrounded by other text tags like <div> <table> etc)?
Add a handler for /path/to/image.jpg, and put <img src="/path/to/image.jpg"> in the HTML? Zach

Thank you, it works. Only the /path/to/image.jpg should always start with a path to your lisp server (like "/hunchentoot/test") otherwise the handler won't work. So, does it mean that if you have a number of images that you want to display you need to create-static-file-dispatcher-and-handler for each of them? Thank you, Andrew On 2/8/07, Zach Beane <xach@xach.com> wrote:
Going trough the test server code it's clear how to diplay an image
On Thu, Feb 08, 2007 at 05:45:01PM -0500, Andrei Stebakov wrote: based on
a static handler or sending a raw image stream to the client. But how can show an image in context of a normal html page (surrounded by other text tags like <div> <table> etc)?
Add a handler for /path/to/image.jpg, and put <img src="/path/to/image.jpg"> in the HTML?
Zach _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

Oh, for a multiple number of images I can use create-folder-dispatcher-and-handler! Looks really neat! Thank you, Andrew On 2/8/07, Andrei Stebakov <lispercat@gmail.com> wrote:
Thank you, it works. Only the /path/to/image.jpg should always start with a path to your lisp server (like "/hunchentoot/test") otherwise the handler won't work. So, does it mean that if you have a number of images that you want to display you need to create-static-file-dispatcher-and-handler for each of them?
Thank you, Andrew
On 2/8/07, Zach Beane <xach@xach.com> wrote:
Going trough the test server code it's clear how to diplay an image
On Thu, Feb 08, 2007 at 05:45:01PM -0500, Andrei Stebakov wrote: based on
a static handler or sending a raw image stream to the client. But how can show an image in context of a normal html page (surrounded by other text tags like <div> <table> etc)?
Add a handler for /path/to/image.jpg, and put <img src="/path/to/image.jpg"> in the HTML?
Zach _______________________________________________ tbnl-devel site list tbnl-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/tbnl-devel

On Thu, Feb 08, 2007 at 06:13:16PM -0500, Andrei Stebakov wrote:
Thank you, it works. Only the /path/to/image.jpg should always start with a path to your lisp server (like "/hunchentoot/test") otherwise the handler won't work. So, does it mean that if you have a number of images that you want to display you need to create-static-file-dispatcher-and-handler for each of them?
Personally, I have a separate webserver for static content such as images, css, and the like. For example, the hunchentoot site http://whatever.xach.com/ might have a corresponding server http://static.whatever.xach.com/ that has a traditional static-file webserver. The lisp server can write files into its document space, and then reference them by sending static.whatever.xach.com urls back to the client. Zach
participants (2)
-
Andrei Stebakov
-
Zach Beane