[Zope] display an image from a DTML document

Ulla Theiss u.theiss@eurodata.de
Thu, 12 Jun 2003 10:04:19 +0200


Hi Sir,

I'm a little bit surprised, that you exclude ladys in your question.
Nevertheless I try to answer because I had almost the same problem.

I separated the images into extra dtml-documents an included them with
the
img tag (<img src="x.html">). 

The disadvantage of this approach is that in the point of view of http
there is
more than one document.

Here is an excerpt of the code:

Little document around the Image:
<!-- $Id: thumbNailFrame.dtml $-->
<dtml-var standard_html_header>
<img src="<dtml-var "displayThumbnail(fileName, REQUEST, RESPONSE)">">
<dtml-var standard_html_footer>

Document that includes the image:
<img src="thumbNailFrame?fileName="emma.gif" alt="Emma" border="0">

Code for displaying the image:
    def displayThumbnail(self, fileName, REQUEST, RESPONSE):
        """ displayThumbnail """
        content = self.readFile(fileName)  # file i/o-operations are in
another method
        RESPONSE.setHeader('Content-Type', 'image/gif')
        RESPONSE.write(content)
        return 

Have a lot of fun with it,
Ulla.