[Zope] Displaying PIL Images in Zope Templates
Andrew Milton
akm at theinternet.com.au
Thu Sep 18 02:30:01 EDT 2008
+-------[ Nico Grubert ]----------------------
| > > The <span> renders "<PIL.Image.Image instance at 0x23b97500>".
| > > How can I show the image?
|
| > Call its tag method.
|
| > <span tal:replace="structure item/tag" />
|
|
| Hi Paul,
|
| how is the susi going? ;-)
|
| I tried <span tal:replace="structure item/tag" /> but I get the
| following error:
You can't do this....
What you need to do is associate the image with a URL so it gets
generated when the browser processes the <img> tag.. UNLESS it's very small
in which case you can use the src="..." attribute to contain the data.
So a PIL image should be returned by a script or external method that
you can browse to. Headers such as Content-Type should be set to set the
image type.
Instead of generating the image on the call to your ZPT you form an <img
src="/some/url/that/makes/my/image?foo=bar&baz=bat"> e.g. in order to
generate the right image.
--
Andrew Milton
akm at theinternet.com.au
More information about the Zope
mailing list