[Zope-dev] Images in Oracle's BLOB Field

Matthew T. Kromer matt@zope.com
Thu, 08 Nov 2001 17:09:43 -0500


Juan Javier Carrera Obrero wrote:

> Hello,
>
>  
>
> I have stored images in a Oracle's BLOB field. I have tried to display 
> them from Zope in a dtml-in method, but I can not show them.
>
>  
>
> Anybody knows to how do it ?
>
>  
>
> Thanks.-
>
>  
>
> Note: I am using Zope 2.4.1, Python 2.1 and Oracle 8i (with the 
> DCOracle2 Adapter).
>
>  
>

Hi Juan,

Sorry I haven't read the list in a while!

It seems to me that the way you do this is by explicitly using the 
LOB.read() mechanism...

ie

<dtml-with "mySQLqueryWhichReturnsALOB" mapping>
<dtml-var expr="LOB.read()">
</dtml-with>

Except that you have to be tricky and make sure there are no newlines 
and so on, so you end up doing like the following (untested, but close):

<dtml-call expr="RESPONSE.set_header('content-type','image/jpeg')
 ><dtml-with ...
 ><next tag
 ><you see the pattern?>