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
>def getDocument(filename):
>      fname = '/mnt/'+filename;
>       input = open(fname,'r')
>       content = MIMEImage( ) )
>       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


You will *not* need a ZPT (nor DTML) for presentation
of binary content. You use then only for textual content.

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to