Re: [Zope] Render image from external method.

2006-02-15 Thread Tino Wildenhain
Jason C. Leach schrieb:
> Hi,
> 
> I'm wondering how I can render an image from an external method
> without creating a permanent image object in Zope?  What I have is a
> python script I call in my ZPT.  The python script does some things,
> and calls an external method that returns PNG image data. If I do
> tal:attributes="src python:python_script()" What I get is the string
> containing the PNG image data, but it's not rendered.
> 
> An example of what I get is: 
> 
> Any ideas?  I don't really want to create a permanent image object,
> and I know that will work because I have used it to create thumbnail
> images before.

Yes, you have to link to the image in your HTML code - just like
any other image you see. (Only a small popolation of browsers
support inline images - and these only really work for fairly small
images - so this isnt an option for you I guess)



If you need parameters to render the image, either put them
into the URL (ZTUtils.make_query() can help here) or
in the SESSION.

Btw, you might be confused by zopes Image objects which behave
in a dual way. When "called" inside your template, they output
a HTML image-tag with a link to their URL. Accessing the URL
however, produces the binary data of that image.

Regards
Tino
___
Zope maillist  -  Zope@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 )


Re: [Zope] Render image from external method.

2006-02-15 Thread Peter Bengtsson
On 2/16/06, Jason C. Leach <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm wondering how I can render an image from an external method
> without creating a permanent image object in Zope?  What I have is a
> python script I call in my ZPT.  The python script does some things,
> and calls an external method that returns PNG image data. If I do
> tal:attributes="src python:python_script()" What I get is the string
> containing the PNG image data, but it's not rendered.
>
> An example of what I get is: 
>
Correct use would be

The *browser* will then call the image, not your ZPT code.

> Any ideas?  I don't really want to create a permanent image object,
> and I know that will work because I have used it to create thumbnail
> images before.
>
> Thanks,
> Jason.
>
> --
> 
>  Jason C. Leach
>  PGP Key: 0x62DDDF75
>  Keyserver: gpg.mit.edu
> ___
> Zope maillist  -  Zope@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 )
>


--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
___
Zope maillist  -  Zope@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 )