srikanth wrote at 2005-4-5 13:11 -0700: > I am using an external method to load an Image from the harddrive. The >external method is as follows: > >from email.MIMEImage import MIMEImage >##parameters=filename >def getDocument(filename): > fname = '/mnt/'+filename; > input = open(fname,'r') > content = MIMEImage( input.read( ) ) > input.close( ) > return content > > >When I try to display the content in the webpage what I actually got is >all raw data of the file rather the image. >So how can I convert the raw data to be dispalyed as image in the >webpage. I am using ZPT to display the web page (image).
Apparently, you do not yet fully understand HTML and ZPT. HTML (and therefore ZPT) is *NOT* intended to present binary data (such as images). I expect you do not understand "MIMEImage" as well. I do not know what it is for but almost surely, it is not for presentation via HTTP... >If its dtml I >could have used <dtml-mime> tag is there any equivalent to that in ZPT. And it would not work. "dtml-mime" is for construction of an "email" message from DTML and not for a webpage presentation. Step back. Read a good book about Web publishing, HTML and HTTP. Learn about how to present binary information in web pages (i.e. via HTTP) -- you will need the "Content-Type" header of HTTP responses. Read about Zope's "REQUEST" and "RESPONSE" objects (in the Zope book or <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>) You will *not* need a ZPT (nor DTML) for presentation of binary content. You use then only for textual content. -- Dieter _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )