Sorry if this has been covered somewhere, but I can't find it and I'm stuck. What I need is an image 'server' of sorts. A single object that will render the contents of an image that is requested. I tried creating a document called imageServer.jpg that contained: <dtml-with images> <dtml-var "imageName.read()"> #also tried _[imageName].read() </dtml-with> I know that I've used that read() before somewhere and I'm thinking it was with a mime tag or something, but that should give you the gist of what I'm trying to do. An object, that I can pass an the name of an image that exists in a folder other than the current one, that will render the image in a format that the browser will accept. TIA Rick
Hi Rick, The way I see it, if all you want is to pass the image back to the browser there are several possible ways: 1. the easiest is pass the url to the image via a REQUEST.redirect 2. If you dont want to do that for whatever reason, the other option is to use an external method to read the image file in binary, get the data, set up REQUEST headers, mainly - Content-type, size, Content-disposition (beware IE doesnt give a hoot about this, look for solutions in the list under content-disposition) and then send back the data. This however does take time. If the browser cant render it, theres not much you can do. The only option then would be to use and external method to convert the image temporarily to an acceptable format and then pass that back. hth AM D. Rick Anderson wrote:
Sorry if this has been covered somewhere, but I can't find it and I'm stuck.
What I need is an image 'server' of sorts. A single object that will render the contents of an image that is requested. I tried creating a document called imageServer.jpg that contained:
<dtml-with images> <dtml-var "imageName.read()"> #also tried _[imageName].read() </dtml-with>
I know that I've used that read() before somewhere and I'm thinking it was with a mime tag or something, but that should give you the gist of what I'm trying to do. An object, that I can pass an the name of an image that exists in a folder other than the current one, that will render the image in a format that the browser will accept.
TIA
Rick
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
D. Rick Anderson writes:
Sorry if this has been covered somewhere, but I can't find it and I'm stuck.
What I need is an image 'server' of sorts. A single object that will render the contents of an image that is requested. I tried creating a document called imageServer.jpg that contained:
<dtml-with images> <dtml-var "imageName.read()"> #also tried _[imageName].read() </dtml-with> Try: <dtml-with images> <dtml-return expr="_.getitem(imageName).index_html(REQUEST,RESPONSE)"> </dtml-with>
Dieter
participants (3)
-
AM -
D. Rick Anderson -
Dieter Maurer