the img tag expects the server to deliver an existing image file from somewhere. What you need to do is a little more complex (!). You COULD write the image into a zope object (bad idea for lots of reasons - eg zodb bloat) or to a localFS (better but still sucky) and deliver it from there using an img tag. AFAIK, this is the ONLY way to embed your image into a page with text and stuff. I use PIL to make images and either email them or return them for the browser to display or to save. Email is good if the generation takes a long time obviously. To get the browser to display a returned image binary, you must set the mime type in the http headers to image/jpeg using or whatever and returning the binary image - the browser will display it correctly. If you want the image to be saveable, it gets worse. IE and netscape are both broken if you try the file-disposition header, it doesn't work as advertised. There's a work around which I use - namely setting the mime type to application/octet-stream
I'm trying to create an external method that will take variables that exist in a ZSQL call and will output an image
based on that:
import Image, ImageDraw, StringIO, os.path
def PILtest(): image = Image.new('RGB',[25,25]) ## IMage Stuff Happens here! return image
Where this would occur in a DTML-Method of:
<dtml-in SQL_COMMAND> <img src="PILtest"> <!--vars to be passed in with this--> </dtml-in>
But I can't get PILtest to output the image itself. Save() doesn't seem to be of help directly. Anyone have any suggestions?
Jason
-- Ross Lazarus Visiting Associate Professor in Medicine, Channing Labs, 181 Longwood Ave., Boston MA 02115, USA. Fax:+617 525 0958, Office: +617 525 2730