[Zope] Using RESPONSE.setHeader to have a Method act like an Image

Trevor Toenjes zope@toenjes.com
Mon, 11 Mar 2002 09:31:18 -0500


More info...setting the header works until I add additional methods.
----
|  <dtml-call "RESPONSE.setHeader('Content-type', 'image/jpeg')">
|  <dtml-var expr="therealimage.data">
----
...works


----
|  <dtml-call "RESPONSE.setHeader('Content-type', 'image/jpeg')">
|  <dtml-var expr="therealimage.data">
|
|  <dtml-var dosomething>
----
...doesnt work properly.  Returns the wrong Content-Length.

-Trevor


> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Trevor Toenjes
> Sent: Monday, March 11, 2002 7:50 AM
> To: zope@zope.org
> Subject: [Zope] How a method only returns the data of an image
>
>
> I need to make a method act like the clone of an image.
> Without extending the Image class...(I would like to do this in DTML or
> python-script)
> I am simply trying to get a method to return the exact data of an Image
> object, so it can be used in normal HTML <IMG
> src="myimage.jpg?somevariable">.  If the Image is a method, it can execute
> some logic based on the QUERY_STRING.
>
> example:  DTML_Method "myimage.jpg"
> # should look and smell like a JPG to the browser (but also execute some
> logic without
> # effecting the image header data)
> ----
> |  <dtml-call "RESPONSE.setHeader('Content-type', 'image/jpeg')">
> |  <dtml-var expr="therealimage.data">
> |  <dtml-var somelogic>
> ----
> But this doesn't return the proper data or Content-Length:
> "therealimage" is a standard Zope Image object.
>
> Any help is greatly appreciated...
> -Trevor
>
>
> _______________________________________________
> 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 )
>