[Zope] Content-type for a method or script

Trevor Toenjes zope@toenjes.com
Mon, 29 Oct 2001 10:33:42 -0500


> Try
> <dtml-call "RESPONSE.setHeader('Content-Type', 'image/gif')">
> <dtml-var "mytestgif.data">
Thanks.  Yes, that works alone to serve the image.
But when I include something like this below, it doesnt work.  I dont know
why...

<dtml-if expr="UID == 'myid'>
    <dtml-call "RESPONSE.setHeader('Content-Type', 'image/gif')">
    <dtml-var expr="mytestgif.data">
<dtml-else>
    <img src="http://anotherdomain/bar.jpg">
</dtml-if>

Thank you for follow-up help.
Trevor



> 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
>
>
>
>
> _______________________________________________
> 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 )
>