display an image from a DTML document
Hi Sirs! 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.) Thank you for your help! /TV. __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com
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
tibo martin wrote at 2003-6-11 06:18 -0700:
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.)
HTML dictates that an image is fetched via an URL. There is no inlined image data inside an HTML page. Dieter
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.
participants (4)
-
Dieter Maurer -
J Cameron Cooper -
tibo martin -
Ulla Theiss