[Zope] Viewing a Blob using DTML

Martin Gebert Murphy@members.netsolution-net.de
Thu, 21 Nov 2002 19:43:17 +0100


Tino Wildenhain schrieb:

> Hi working,
>
> whats the reason in not using a python script? You said early
> you had it working with python script. So why hassle with the
> ugly DTML?


I do the following in a Python script called getFoto:

foto = context.db.getFoto(Person_ID=pid)
container.REQUEST.RESPONSE.setHeader('content-type', 'image/' + foto[0].Type)
return foto[0].Pic

(where Type is the second part of the MIME type and Pic is the BLOB 
data) and can call that script simply in a <img> tag:

<img src="getFoto?pid=&dtml-PID;" alt="Foto">

Seems to me a more elegant solution.

Martin