[Zope] question on howto readfile(img)

Cliff Ford Cliff.Ford at ed.ac.uk
Thu Jan 20 04:26:38 EST 2005


Easy questions may have multiple answers. If someimage.jpg is a static 
image that really exists you could do it like this:

<dtml-var standard_html_header>
<dtml-var expr="restrictedTraverse(REQUEST.img)">
<dtml-var standard_html_footer>

This actually puts a standard image tag in the output (you probably have 
your own header and footer).

If the image is a dynamic entity or fetched from a database, then you 
need to use <dtml-call RESPONSE.setHeader('Content-Type','image/jpeg')>
rather than dtml-var, and then return the image content.

Cliff

Wombie Tomek wrote:
> i have what i hope is a fairly easy question that's been alluding me
> for a few hours.  i've been trying to rewrite a little script i wrote
> in php long ago.
> 
> i need to have a script, which returns an image once it decides it
> exists... the only thing i don't have worked out is how to do
> something like this:
> 
>    <dtml-var RESPONSE.setHeader('Content-Type','image/jpeg')>
>    readfile(img+?size=thumb);  <<----not sure how to do this, this is from php  
> 
> img being a path given through the url:     ie  ?img=somefolder/someimage.jpg
> 
> thanks,
> 
> holden
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )


More information about the Zope mailing list