[Zope] DTML Method or PyScript returning image?

CJ Kucera pez@apocalyptech.com
Mon, 8 Oct 2001 23:27:21 -0500 (CDT)


Greetings all; I've got a question about Images for you.

Basically, my situation is this:  I've got images 1.gif, 2.gif, 3.gif,
and 4.gif in a folder.  What I want to do is set up an object of
some sort called "image.gif", which, when called, would randomly return
one of the other graphics in the Folder.

I'm guessing I'll have to set the content-type of the image and then
just return the data, but it's returning the data that's the problem.
Here's basically what I've got in a Python Script right now:

> myImage = context[str(context.getImageNum()) + '.gif']
> 
> RESPONSE.setHeader('Content-Type', myImage.getContentType())
> return myImage

"getImageNum" is another Python Script in the same directory which
returns a valid number for the graphic, and that part works fine.
The Content-Type is set properly as well, but when I return the
image, it actually returns the "<IMG SRC= . . .>" rather than
the image data itself.

I'm using Zope 2.3.2, if that makes a difference . . .

Thanks in advance for help!
-CJ

WOW: Rapacious           | A priest advised Voltaire on his death bed to
apocalyptech.com/wow     |  renounce the devil.  Replied Voltaire, "This
pez@apocalyptech.com     |              is no time to make new enemies."