[Zope] Display Image Object in DTML

Tino Wildenhain tino at wildenhain.de
Wed Jun 21 04:31:25 EDT 2006


jose carlos schrieb:
> Hi all,
> 
> i'm trying to show a Image object in dtml but i don known how to do it.
> 
> i have a user object and this user have a jpg foto atributte.
> this foto atributte is a instance of OFS.Image and when i try to view in
> dtml only view Ascii character..
> 
> i think about to create a temporary file and then in dtml use that url
> but i dont like that solution.
> 
> i would like hear any ideas..

<img src="/path/to/userobject/imageattribute" witdh="..." height="..." alt="the user" />

maybe?

If you cant access the userobject by path, a small wrapper (python script)
should do it:

if traverse_subpath:
     return context.acl_users.getUser(traverse_subpath[0]).imageattribute.data


then you can have above link in your HTML image tag like

/path/to/the/pythonscript/userid

which would return, when called by the subsequent browser request,
just the image data.


More information about the Zope mailing list