[Zope] Content-type for a method or script
Oliver Bleutgen
myzope@gmx.net
Mon, 29 Oct 2001 11:03:13 +0100
Trevor Toenjes wrote:
> I need to render an image with some logic from a request in an external
> (non-zope page)
>
> example request from html: <img
> src="http://zope/images/header.gif?UID=sdflkj">
>
> DTML_Method "header.gif"
> <dtml-call "RESPONSE.setHeader('Content-Type', 'image/gif')">
> <dtml-var mytestgif>
> my ID=<dtml-var UID>
>
> mytestgif is an 'Image' in zope.
> It renders fine when I test the URL http://zope/images/header.gif?UID=sdflkj
Yeah, but did you look at the file you _really_ got?
It was an html-file with an image tag in it, I bet - bad food for
another image tag.
<dtml-var image> will not return the image-data, but the above mentioned
image tag.
Try
<dtml-call "RESPONSE.setHeader('Content-Type', 'image/gif')">
<dtml-var "mytestgif.data">
And beware, it will also work on internet explorer if you
don't set the right header, but that's plain wrong.
What do you want to achieve with that my ID=<dtml-var UID> stuff?
cheers,
oliver