[Zope] display an image from a DTML document

J Cameron Cooper jccooper@jcameroncooper.com
Wed, 11 Jun 2003 12:41:59 -0500


>
>
>Once I've retrieved the content of an image file (tif,
>jpeg ...), how can I display the resulting image of
>this file from the data in a dtml document? ( I don't
>want to store an image OBJECT in the container.)
>  
>
Not sure I know what you mean, but I think your best bet is to store it 
in a temporary folder and then reference it there. If you have an image 
uploaded to some page, I suppose you could also write a script that you 
call in the context of the processing script/page that returns the 
contents of your REQUEST parameter holding the image. Something like::

if context.REQUEST.has_key('jpg_image'):
    img = context.REQUEST.jpg_image
else:
    img = container.substitute_image.data
 
return img  # you may want to do str(img)

If you've read the list for a few days, you've seen something very 
similar already. It would be used in the action of some form with an 
input type=file name=jpg_image like so::

<img src="the_above_script">

I haven't tried this, but I think it should work.

          --jcc