[Zope] Re: External method and image

Maik Jablonski maik.jablonski at uni-bielefeld.de
Thu Oct 16 06:53:03 EDT 2003


Michel Pottier wrote:
>   I have one external method which create jpeg file. I shall want to be
> able to display these images in html page. I have tried  different
> methods to do that, but either I get the image (only the image) or I get
> the html page ( without image). How this can be done?
>  In external method i have something like:
> 
>    (stin,stout) = os.popen2(commande)
>     stin.close()
>     resultat = stout.read()
>     stout.close()
>     REQUEST.RESPONSE.setHeader('Content-type','image/jpeg')
>     REQUEST.RESPONSE.write(resultat)
> 
> and in dtml page i have try:
> "
>  <dtml-var standard_html_header>
>  .....
>  <dtml-var "creGraph(REQUEST)">
> or <img src="<dtml-var "creGraph(REQUEST)">"> or ..
> 
> <dtml-var standard_html_footer> 
> "
> where creGraph is the external method

What you do:

<img src="YouIncludeTheBinaryDataOfTheImageBetweenTheQuotes">

Correct is:

<img src="PathToTheImageSoTheBrowserCanFetchItViaHTTP">

Hope this helps.

Cheers, Maik





More information about the Zope mailing list